RFR: 8349098: TabPane: exception initializing in a background thread [v2]

Kevin Rushforth kcr at openjdk.org
Fri Feb 14 16:23:24 UTC 2025


On Fri, 14 Feb 2025 16:12:27 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java line 523:
>> 
>>> 521:                 };
>>> 522: 
>>> 523:                 if (Platform.isFxApplicationThread() && (closeTabAnimation.get() == TabAnimation.GROW)) {
>> 
>> With this check, non Application thread cannot play the animation but in else block the `cleanup` is executed on the same thread.
>> Can there still be a situation when, this non-Application thread and Application thread be concurrently modifying the tab?
>
> If you mean two threads accessing this same TabPaneSkin instance, then that's not a valid case. JavaFX objects are not thread-safe when accessed from multiple threads. This bug (and the other related bugs fixed or under review) is about making sure that multiple threads, including the JavaFX application thread, each concurrently accessing their own instance, don't interfere with each other.
> 
> So it would only be a problem if "cleanup" attempted some animation or touched static state or similar, which is doesn't look like it does.

Although, having said that, the purpose of the cleanup is to clean up after the animation. So a better fix might be to put the entire if-else inside an `if (Platform.isFxApplicationThread())` test.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1699#discussion_r1956407884


More information about the openjfx-dev mailing list