-
Bug
-
Resolution: Fixed
-
P4
-
fx2.1
-
JavaFX 2.1b14
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)
Win7 64
In an attempt to reproduce another odd issue with a race condition I managed to "reproduce" something else instead:
Exception in thread "runLater" java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:121)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:116)
at javafx.application.Platform.runLater(Platform.java:52)
at test.swing.FXInitTest$1.run(FXInitTest.java:23)
Steps to reproduce:
1. Start the attached application and restart until the exception occurs. I never needed more than 5 starts.
This is strange. The test uses 5 threads. Each of these creates a JFXPanel and then creates a Button (via runLater). The JFXPanel should only init the toolkit by calling initFX in its constructor which eventually set the initalized flag on PlatformImpl. In spite of that, some threads manage to get to the runLater with initialized still being false.
The same thing happens if the test code is triggered when a JButton is clicked. This part is not included in the code because there is no difference in the outcome. By the way, creating a JFXPanel seems like a workaround anyway. If this is commented out, Platform.runLater will always fail at the initialized check. See alsoRT-13289.
Exception in thread "runLater" java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:121)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:116)
at javafx.application.Platform.runLater(Platform.java:52)
at test.swing.FXInitTest$1.run(FXInitTest.java:23)
Steps to reproduce:
1. Start the attached application and restart until the exception occurs. I never needed more than 5 starts.
This is strange. The test uses 5 threads. Each of these creates a JFXPanel and then creates a Button (via runLater). The JFXPanel should only init the toolkit by calling initFX in its constructor which eventually set the initalized flag on PlatformImpl. In spite of that, some threads manage to get to the runLater with initialized still being false.
The same thing happens if the test code is triggered when a JButton is clicked. This part is not included in the code because there is no difference in the outcome. By the way, creating a JFXPanel seems like a workaround anyway. If this is commented out, Platform.runLater will always fail at the initialized check. See also
- relates to
-
JDK-8088865 Need better documentation for the FX initialization process
-
- Resolved
-