Zitat von Nir Lisker <nlis...@gmail.com>:

BTW, Tomas Mikula wrote about this on
http://tomasmikula.github.io/blog/2015/02/10/the-trouble-with-weak-listeners.html
.
There is a comment at the end that is worth a read too.



thanks for the reference, thought I had seen something like that but couldn't find it :)

On Thu, Mar 26, 2020 at 1:53 PM Jeanette Winzenburg <faste...@swingempire.de>
wrote:


Zitat von Kevin Rushforth <kevin.rushfo...@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 ..







Reply via email to