RFR: 8349096: Split/MenuButton: exception initializing in a background thread
Michael Strauß
mstrauss at openjdk.org
Wed Feb 12 23:06:13 UTC 2025
On Wed, 12 Feb 2025 20:15:03 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> ## Root Cause
>
> The ContextMenu (PopupWindow) cannot be shown in a background thread.
>
> ## Solution
>
> Bail out of `show()` if in a background thread.
I'm not convinced that this is the right solution.
`Node` says:
* Node objects may be constructed and modified on any thread as long they are
* not yet attached to a {@link Scene} in a {@link Window} that is
* {@link Window#isShowing showing}.
It's not clear to me that invoking actions on a node should count as "modifying", and there is no specification that says it's okay to invoke actions on a non-UI thread. I'd rather have actions throw an exception if they are invoked on a background thread, rather than silently not doing anything at all.
It's one thing to configure (i.e. modify) properties of a node, and then show it in the scene graph; it's another thing to tell it to do something it can't do in its current state.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1709#issuecomment-2655033677
More information about the openjfx-dev
mailing list