It is possible to crash Swing by calling Platform.Exit()
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;
import javax.swing.*;
public class PlatformExitCrash extends Application {
public static void main(String[] args) {
SwingUtilities.invokeLater(PlatformExitCrash::createSwing);
Application.launch(args);
}
private static void createSwing() {
JDialog d = new JDialog();
Platform.runLater(()-> {
Platform.exit();
});
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}
d.setVisible(true);
}
@Override
public void start(Stage st) {
}
}
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;
import javax.swing.*;
public class PlatformExitCrash extends Application {
public static void main(String[] args) {
SwingUtilities.invokeLater(PlatformExitCrash::createSwing);
Application.launch(args);
}
private static void createSwing() {
JDialog d = new JDialog();
Platform.runLater(()-> {
Platform.exit();
});
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}
d.setVisible(true);
}
@Override
public void start(Stage st) {
}
}
- is cloned by
-
JDK-8339178 [macos] Swing InterOp Platform.exit() crash
- Resolved
- relates to
-
JDK-8185634 Java Fx-Swing dialogs appearing behind main stage
- Resolved
-
JDK-8335630 Crash if Platform::exit called with fullScreen Stage on macOS 14
- Resolved
-
JDK-8340849 [macos] Crash when creating a child window of a JavaFX window after Platform::exit
- Resolved
-
JDK-8340442 Enable SwingNodePlatformExitCrashTest after JDK-8340849 is fixed
- Resolved
- links to
-
Commit(master) openjdk/jdk/9a1024de
-
Review(master) openjdk/jdk/20688
(2 links to)