TitledPane fails to initialize in a background thread when adding a series, throwing a
java.lang.NullPointerException: Cannot invoke "javafx.scene.Parent.childVisibilityChanged(javafx.scene.Node)" because the return value of "javafx.scene.Node.getParent()" is null
To reproduce, use the newly developed NodeInitializationStressTest:
```
@Test
public void titledPane() {
assumeFalse(SKIP_TEST);
test(() -> {
TitledPane c = new TitledPane("TitledPane", null);
c.setSkin(new TitledPaneSkin(c));
return c;
}, (c) -> {
c.setAnimated(nextBoolean());
c.setExpanded(nextBoolean());
c.setContent(new Label(nextString()));
accessControl(c);
});
}
```
Exception:
java.lang.NullPointerException: Cannot invoke "javafx.scene.Parent.childVisibilityChanged(javafx.scene.Node)" because the return value of "javafx.scene.Node.getParent()" is null
at javafx.graphics/javafx.scene.Node$9.invalidated(Node.java:1441)
at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
at javafx.graphics/javafx.css.StyleableBooleanProperty.set(StyleableBooleanProperty.java:103)
at javafx.graphics/javafx.scene.Node.setVisible(Node.java:1420)
at javafx.controls/javafx.scene.control.skin.TitledPaneSkin.lambda$10(TitledPaneSkin.java:396)
at javafx.graphics/com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(TimelineClipCore.java:239)
at javafx.graphics/com.sun.scenario.animation.shared.TimelineClipCore.playTo(TimelineClipCore.java:180)
at javafx.graphics/javafx.animation.Timeline.doPlayTo(Timeline.java:172)
at javafx.graphics/javafx.animation.AnimationAccessorImpl.playTo(AnimationAccessorImpl.java:39)
at javafx.graphics/com.sun.scenario.animation.shared.SingleLoopClipEnvelope.timePulse(SingleLoopClipEnvelope.java:103)
at javafx.graphics/javafx.animation.Animation.doTimePulse(Animation.java:1234)
at javafx.graphics/javafx.animation.Animation$1.timePulse(Animation.java:190)
at javafx.graphics/com.sun.scenario.animation.AbstractPrimaryTimer.timePulseImpl(AbstractPrimaryTimer.java:316)
at javafx.graphics/com.sun.scenario.animation.AbstractPrimaryTimer$MainLoop.run(AbstractPrimaryTimer.java:239)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:588)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$6(QuantumToolkit.java:346)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
## Root Cause
Animation was started in the background thread, causing concurrent access.
## Solution
Disable animation if not the fx app thread.
java.lang.NullPointerException: Cannot invoke "javafx.scene.Parent.childVisibilityChanged(javafx.scene.Node)" because the return value of "javafx.scene.Node.getParent()" is null
To reproduce, use the newly developed NodeInitializationStressTest:
```
@Test
public void titledPane() {
assumeFalse(SKIP_TEST);
test(() -> {
TitledPane c = new TitledPane("TitledPane", null);
c.setSkin(new TitledPaneSkin(c));
return c;
}, (c) -> {
c.setAnimated(nextBoolean());
c.setExpanded(nextBoolean());
c.setContent(new Label(nextString()));
accessControl(c);
});
}
```
Exception:
java.lang.NullPointerException: Cannot invoke "javafx.scene.Parent.childVisibilityChanged(javafx.scene.Node)" because the return value of "javafx.scene.Node.getParent()" is null
at javafx.graphics/javafx.scene.Node$9.invalidated(Node.java:1441)
at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
at javafx.graphics/javafx.css.StyleableBooleanProperty.set(StyleableBooleanProperty.java:103)
at javafx.graphics/javafx.scene.Node.setVisible(Node.java:1420)
at javafx.controls/javafx.scene.control.skin.TitledPaneSkin.lambda$10(TitledPaneSkin.java:396)
at javafx.graphics/com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(TimelineClipCore.java:239)
at javafx.graphics/com.sun.scenario.animation.shared.TimelineClipCore.playTo(TimelineClipCore.java:180)
at javafx.graphics/javafx.animation.Timeline.doPlayTo(Timeline.java:172)
at javafx.graphics/javafx.animation.AnimationAccessorImpl.playTo(AnimationAccessorImpl.java:39)
at javafx.graphics/com.sun.scenario.animation.shared.SingleLoopClipEnvelope.timePulse(SingleLoopClipEnvelope.java:103)
at javafx.graphics/javafx.animation.Animation.doTimePulse(Animation.java:1234)
at javafx.graphics/javafx.animation.Animation$1.timePulse(Animation.java:190)
at javafx.graphics/com.sun.scenario.animation.AbstractPrimaryTimer.timePulseImpl(AbstractPrimaryTimer.java:316)
at javafx.graphics/com.sun.scenario.animation.AbstractPrimaryTimer$MainLoop.run(AbstractPrimaryTimer.java:239)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:588)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$6(QuantumToolkit.java:346)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
## Root Cause
Animation was started in the background thread, causing concurrent access.
## Solution
Disable animation if not the fx app thread.
- blocks
-
JDK-8348987 ☂ Thread safety in Node initialization
-
- In Progress
-
- is blocked by
-
JDK-8347392 Thread-unsafe implementation of c.s.j.scene.control.skin.Utils
-
- Resolved
-
- links to
-
Commit(master) openjdk/jfx/01059d4f
-
Review(master) openjdk/jfx/1707