Created
April 16, 2018 20:51
-
-
Save micheljung/b171b4e397306b5541ebd2fab7422538 to your computer and use it in GitHub Desktop.
Reproduces https://bugs.openjdk.java.net/browse/JDK-8164446 JavaFX's addListener() isn't thread safe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.Application; | |
import javafx.beans.property.SimpleStringProperty; | |
import javafx.beans.property.StringProperty; | |
import javafx.stage.Stage; | |
public class JDK8164446 extends Application { | |
@Override | |
public void start(Stage primaryStage) { | |
StringProperty stringProperty = new SimpleStringProperty(); | |
new Thread(() -> { | |
while (true) { | |
stringProperty.addListener((observable, oldValue, newValue) -> noop()); | |
} | |
}).start(); | |
while (true) { | |
stringProperty.addListener((observable, oldValue, newValue) -> noop()); | |
} | |
} | |
private static void noop() { | |
} | |
public static void main(String[] args) { | |
launch(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment