Todd Volkert wrote:
> Right.  Arguably, pivot.util.ListenerList could be using
> WeakReferences, which would eliminate this problem (treeData would
> never develop a string reference back to treeView).  However, it would
> also arguably hurt the performance of listener lists, which would be
> unfortunate.  That's assuming that weak references are slower than
> strong references, which I thought I read somewhere...
>   
No, that's not the point.

Let's say I write code like this:

component.addListener(new MyListener() {
  void doSomething() {}
});

And lets say the ListenerList is using WeakReference's.
What do you think will happen to the inner class I created to handle the
event?
That right, it will get GC'ed, but not before working for somewhere
between a few seconds and a few minutes (depending on memory pressure)
and thus completely confusing the poor programmer.

Sorry, but I've been down this path and it's a dead end.

Regards, Noel.

Reply via email to