Discuss: SkinBase - add api to support register InvalidationListeners

Jeanette Winzenburg fastegal at swingempire.de
Mon Jan 11 11:50:53 UTC 2021

Thanks, Kevin :)

Starting work.

-- Jeanette

Zitat von Kevin Rushforth <kevin.rushforth at oracle.com>:

> I think this sounds like a very natural addition to the API. Making  
> it easier for controls to clean up after themselves seems like a win.
> -- Kevin
> On 1/7/2021 5:45 AM, Jeanette Winzenburg wrote:
>> 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