On Wed, 30 Nov 2022 21:08:15 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

>> Andy Goryachev has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8294589: cleanup
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/MenuBarSkin.java
>  line 293:
> 
>> 291: 
>> 292:             if (scene != null ) {
>> 293:                 sceneListenerHelper = new 
>> ListenerHelper(MenuBarSkin.this);
> 
> Why does this (still) need to rely on a weak reference?  Skins have a well 
> specified life cycle do they not?

You are right: some weak listeners remain, I did not want to re-write the whole 
thing for a fear of introducing regression and to keep the changes to a minimum.

The second `ListenerHelper` (line 293) gets disconnected in dispose(), or when 
the skin is collected (since the skin may not be explicitly uninstalled, but 
instead the whole component or `Pane` might be removed from the scene and 
discarded.

-------------

PR: https://git.openjdk.org/jfx/pull/906

Reply via email to