RFR: 8252935: Add treeShowing listener only when needed [v2]

John Hendrikx jhendrikx at openjdk.java.net
Sun Jan 24 09:27:40 UTC 2021

On Fri, 22 Jan 2021 21:32:28 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> John Hendrikx has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
>>   WIP: Moved treeShowingProperty into its own class
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/ProgressIndicatorSkin.java line 239:
>> 237:         super.dispose();
>> 238: 
>> 239:         treeShowingExpression.dispose();
> This could be removed if you are able to use `registerChangeListener` to add the listener.

I'm not so sure, the listener will be removed from the `TreeShowingExpression` that was created, but the `TreeShowingExpression` itself is also registering listeners on the `ProgressIndicator`.  I don't see any `dispose` calls being done by the helper code.  If I'm correct, switching skins multiple times on a `ProgressIndicator` would create multiple `TreeShowingExpression`s which would create listeners on the `ProgressIndicator` which in turn reference the expression -- this would prevent the discarded skins from being GC'd.


PR: https://git.openjdk.java.net/jfx/pull/185

More information about the openjfx-dev mailing list