Change 20100314-maxcarlson-0 by maxcarl...@bank on 2010-03-14 00:54:51 PST
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: UPDATED: Automatically remove invalid delegates in 
LzEventable.destroy()

Bugs Fixed: LPP-8822 - Improve layout performance

Technical Reviewer: ptw
QA Reviewer: hminsky

Details: Updated to address Andre's comments:
> Not approved, because
>
> 1) delegates will now leak memory until their context is destroyed

True, but delegates are tiny, compared to the risk of leaking a entire nodes 
that currently exists.

> 2) you really should integrate this approach with LzNode#__LZdelegates

I though of that, but __LZdelegates is used especially to track delegates that 
need to be applied - see LzState.apply()

> 3) just setting the delegate's context to null doesn't look right,
> instead call unregisterAll() and prevent further calls to register(..)
> (if you intended to remove the reference from the delegate to the
> context, you also should set the method reference to null, because of
> bound methods, cf. ActionScript3)

Agreed.  this is done.

> 4) API change: releaseLayout()'s contract is changed, cf. last mail from
> Tucker

Fixed. 

> 5) missing integration with explicit delegate unregister code, cf.
> LzInputText#destroy() (may be added in an additional change - but there
> needs to be a note at least!) 

I think I caught all these.  

LzInputText,LzAnimatorGroup,LzDatapointer,LzDataset - Remove extra delegate 
unregistration as it's now handled by the event system.

Otherwise the same as before:

LzEventable - Add _delegates array to hold delegates that have a context 
pointing to this object.  Clean out delegate contexts in destroy().

LaszloEvents - LzDelegate registers on its contexts' _delegates array.

LaszloLayout,resizelayout - don't track delegates anymore.

Tests: Run modified leak-components test in swf10 - the memory monitor in the 
upper left shows much less leakage with this patch: you can click the monitor 
to force garbage collection.

Files:
M       test/components/lz/leak-components.lzx
M       WEB-INF/lps/lfc/core/LzEventable.lzs
M       WEB-INF/lps/lfc/views/LzInputText.lzs
M       WEB-INF/lps/lfc/events/LaszloEvents.lzs
M       WEB-INF/lps/lfc/controllers/LzAnimatorGroup.lzs
M       WEB-INF/lps/lfc/controllers/LaszloLayout.lzs
M       WEB-INF/lps/lfc/data/LzDatapointer.lzs
M       WEB-INF/lps/lfc/data/LzDataset.lzs
M       lps/components/utils/layouts/resizelayout.lzx

Changeset: 
http://svn.openlaszlo.org/openlaszlo/patches/20100314-maxcarlson-0.tar

Reply via email to