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

Jeanette Winzenburg fastegal at openjdk.java.net
Sun Jan 24 12:02:43 UTC 2021

On Sun, 24 Jan 2021 09:24:56 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> 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.

agreed, nested listeners to control's - nested - properties must be removed (whether or not parent was added via the skin api)

Unrelated (and too lazy to check ;) wondering if there are any tests for those nested listeners doing/not their respected jobs after before/after dispose?


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

More information about the openjfx-dev mailing list