Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3977

ListModel listdatalistener not cleared when component is destroyed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 8.6.0
    • 8.5.1.2
    • None
    • Security Level: Jimmy
    • None
    • ZK 8.6.0 S1
    • None

      Steps to Reproduce

      http://zkfiddle.org/sample/1pgc3tp/5-zk-listmodel-listdataListener-not-cleaned-on-destroy

      run fiddle
      add radiogroup (click on toggle button)
      select radio A
      toggle the element attached and detached twice (4 clicks on toggle button)
      select radio B
      toggle the element attached and detached once (2 clicks on toggle button)

      Current Result

      A is selected

      Expected Result

      B is selected

      Debug Info

      Not related to component (happen on any listmodel based comp)

      most likely caused by AbstractListModel _listeners not beeing destroyed when the shadow element content is removed from UI
      When selection happen, selection is synced with all previous Radiogroup instances already removed from UI, which cause sync issues.

      on ZK 8.5.0 - listeners are not cleaned up, but the model selection is not affected by old listeners
      on ZK 8.5.1.2 - listeners are not cleaned up, selection is affected

      Root Cause

      org.zkoss.zul.AbstractListModel._listeners still contain listeners for selection states for Radiogroups already removed from page tree.

      Workaround

            CharlesQiu CharlesQiu
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 2 days Original Estimate - 2 days
                2d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 6 hours, 30 minutes
                2d 6h 30m