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

leaking variable resolvers when using programmatic templates

XMLWordPrintable

    • ZK 8.6.2 S1

      Steps to Reproduce

      run the attached example

      Current Result

      the each expression at the bottom resolves to the last value of the list model

      Expected Result

      each should resolved to null

      Debug Info

      Root Cause

      ForEachRenderer is adding a variable resolver to the current execution in each iteration
      https://github.com/zkoss/zkcml/blob/v8.6.1/zuti/src/org/zkoss/zuti/zul/ForEachRenderer.java#L64

      But doesn't clean it up.

      A template defined in a zul page uses TemplateImpl which does the clean up by default, but also adds the VariableResolver.

      (adds the same variable resolver again)
      https://github.com/zkoss/zk/blob/v8.6.1/zk/src/org/zkoss/zk/ui/impl/UiEngineImpl.java#L2307
      (removes it)
      https://github.com/zkoss/zk/blob/v8.6.1/zk/src/org/zkoss/zk/ui/impl/UiEngineImpl.java#L2341

      Workaround

      manually remove the variable resolver during template.create
      (commented out in the attachment)

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 2 hours Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - 2 hours Remaining Estimate - 2 hours Time Not Required
                2h