JDK-8339178 : [macos] Swing InterOp Platform.exit() crash
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: jfx11,8,jfx23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2024-08-28
  • Updated: 2024-09-19
  • Resolved: 2024-09-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx24 b08Fixed
Related Reports
Cloners :  
Relates :  
Relates :  
Relates :  
Description
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) {
    }
}
Comments
Changeset: 46522826 Branch: master Author: Kevin Rushforth <kcr@openjdk.org> Date: 2024-09-03 19:16:55 +0000 URL: https://git.openjdk.org/jfx/commit/465228269ba1d9ad4e902e9f161b79b8a1ebcd81
03-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1545 Date: 2024-08-26 21:11:03 +0000
28-08-2024

This is the JavaFX equivalent of AWT bug JDK-8190329. As discussed in the PR for the AWT fix [1] we plan to fix this in both FX and AWT. They are independent fixes, either of which is sufficient to avoid the crash. [1] https://github.com/openjdk/jdk/pull/20688#discussion_r1729333420
28-08-2024