> WeakReferences are not a solution, because the application developer > might not keep a reference to treeData, which means the TreeView would > mysteriously lose it's connection to the data object when GC next runs.
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... > Swing has hierarchy listeners which allow a component to do this. Yeah, and we could add a similar interface. For all data driven components to do that is a lot of overhead though for a corner-case problem :) > In Swing, it is not at all normal to keep a reference to the model > object after you have removed a component from the view hierarchy, so > Swing doesn't do anything. Agreed. Though this discussion has piqued my interest about renewed discussions in ListenerList/WeakReference.
