On May 22, 2006, at 1:37 PM, P T Withington wrote: > It just occurred to me that we could simulate weak references to > solve the issue with cross-node delegates not getting automatically > collected. > > We simulate weak references by having a node table. Every node that > gets created gets a unique id and enters itself in the node table. > When you make a delegate, you don't store the node, just the node > id. To invoke a delegate, you look up the node in the node table. > When a node is deleted, is simply removes itself from the node > table. Delegates that don't find their node in the node table should > unregister themselves... > > Thoughts? >
Works for me. Having to unhook delegates is one of those things where we know there will be bugs forever, since it's such a corner case and many app developers have to be aware. It would be nice to get rid of that. To avoid the node table getting too big, you could store it on a per- event basis (but still calculating one UID per node). This might be more memory-intensive depending on event density, though... but you could use the profiler to calculate how much redundancy there would be with that scheme. jim _______________________________________________ Laszlo-dev mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
