RFR: 8349091: Charts: exception initializing in a background thread [v6]
Andy Goryachev
angorya at openjdk.org
Mon Mar 3 21:45:02 UTC 2025
On Mon, 3 Mar 2025 21:30:42 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> Was this solution considered:
>>
>> ObservableValue<Boolean> partOfSceneGraph = this.sceneProperty()
>> .flatMap(Scene::windowProperty)
>> .flatMap(Window::showingProperty)
>> .orElse(false);
>>
>> symbol.focusTraversableProperty()
>> .bind(Platform.accessibilityActiveProperty().when(partOfSceneGraph));
>>
>> What the above code does is create a binding on the `when` statement (a listener is added on the `when` result). However, the `when` property will not add a listener on `Platform.accessibilityActiveProperty()` until `partOfSceneGraph` is `true`. As soon as it does though, a listener is installed on `Platform.accessibilityActiveProperty()` and its latest value is set to `focusTraversableProperty` via the bind.
>
> The above does require though that `Platform.accessibilityActiveProperty()` is properly synchronized. I think it may be a good idea to fix that first. Perhaps all platform provided properties (if there are more) should ensure they're only initialized once.
unrelated, but I would rather disallow background access to any platform properties.
_per the earlier email_, this might (read: will) create concurrent access when the node is not yet attached to the scene graph:
background thread fx app thread
1. start creating the node
2. add listener to platform prop
3. keep initializing the node <-- platform property change notification
4. some more code
step 3 is when concurrent access occurs.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1697#discussion_r1978282003
More information about the openjfx-dev
mailing list