Discuss: SkinBase - add api to support register InvalidationListeners

Jeanette Winzenburg fastegal at swingempire.de
Thu Jan 7 13:45:53 UTC 2021

Recently filed (RFE) https://bugs.openjdk.java.net/browse/JDK-8258777  
- it's about adding api to support un/register invalidationListener  
just the same way as changeListener.

Trigger was work on cleaning up skins such that they don't misbehave  
(f.i. leaking memory or throwing exception,  
https://bugs.openjdk.java.net/browse/JDK-8241364) on switching the  
skin. Most of the related issues boil down to incomplete removal of  
listeners. As far as manual added (but not removed) changeListeners  
are involved, the fix is to use skin.registerChangeListener: all those  
are auto-removed in skinbase.dispose.

For InvalidationListeners, the fix is cumbersome: it requires storing  
both the listener and its weak wrapper, manually adding the weak  
wrapper and manually removing it in dispose. Getting really boring if  
a skin (like TextInputXX) registers many of them ..

IMO, not having symmetric support of invalidation- vs changeListeners  
in SkinBase api very much feels like an omission - which would be  
fixed by this :)

Opinions, please.

-- Jeanette

More information about the openjfx-dev mailing list