WeakXXListener - when not to use?
    Jeanette Winzenburg 
    fastegal at swingempire.de
       
    Thu Mar 26 11:52:32 UTC 2020
    
    
  
Zitat von Kevin Rushforth <kevin.rushforth at oracle.com>:
Thanks for your input!
Glad we didn't miss the "minimum bar" height - with the java doc being  
really clear on that :)
What I still don't quite get is the concern about "too early" and "not  
cleaning up" - maybe I misunderstand the point entirely
>
> As for whether the above is sufficient, it depends on what the  
> listener does (what its purpose is).In this simple example, it seems  
> unlikely that removing the listener when the instance of SomeClass  
> goes out of scope will cause any problems. It's worth looking at  
> what "doSomethingUseful" does to see if unregisters anything that  
> ought to be unregistered (and now maybe won't be if the listener  
> goes away early).
>
if not doing that "doSomethingUseful" would cause a - more - terrible  
misbehavior than a memory leak, would that mean that the  
listening/update implementation in that specific case would have to be  
re-thought? F.i. in the case of the ButtonSkin listening to control's  
scene is changing global state which might be broken if it's not  
reverted to not having a default/cancel registered? (what a horrible  
sentence, sry ;)
Hmm ..
    
    
More information about the openjfx-dev
mailing list