On Wed, 26 Feb 2025 14:40:16 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> Andy Goryachev has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 25 commits: >> >> - Merge remote-tracking branch 'origin/master' into >> 8349091.charts.thread.safety >> - review comments >> - Merge remote-tracking branch 'origin/master' into >> 8349091.charts.thread.safety >> - Merge remote-tracking branch 'origin/master' into >> 8349091.charts.thread.safety >> - enabled pie chart test >> - Merge branch 'master' into 8349091.charts.thread.safety >> - Merge branch 'master' into 8349091.charts.thread.safety >> - whitespace >> - Merge remote-tracking branch 'origin/master' into >> 8349091.charts.thread.safety >> - cleanup >> - ... and 15 more: https://git.openjdk.org/jfx/compare/7a7854c9...4288d1d0 > > modules/javafx.controls/src/main/java/javafx/scene/chart/Chart.java line 561: > >> 559: accessibilityActive = winProp; // keep the reference so >> it won't get gc >> 560: >> 561: // lambda cannot be used in place of a ChangeListener >> in removeListener() > > Why not use a Subscription then? It seems tailor-made for what you are trying > to do. I don't know how to use Subscription in this case. This does not work: ObservableValue<Window> winProp = sceneProperty().flatMap(Scene::windowProperty); accessibilityActive = winProp; // keep the reference so it won't get gc Subscription sub = winProp.subscribe((win) -> { if (win != null) { if (accessibilityActive == winProp) { accessibilityActive = null; } if (isAccessibilityActive()) { handleAccessibilityActive(true); } //winProp.removeListener(this); sub.unsubscribe(); <-- COMPILE ERROR } }); ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1697#discussion_r1975861040