JDK-8114065 : Mac: need workaround for crash / hang on exit issues
  • Type: Bug
  • Component: javafx
  • Sub-Component: application-lifecycle
  • Affected Version: fx2.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2011-08-03
  • Updated: 2015-06-16
  • Resolved: 2011-08-08
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
fx2.0Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
JavaFX does not exit cleanly on the Mac platform due to  RT-15032 and RT-15599. A complete fix for these bugs may be difficult. In the mean time, this is seriously impacting app developers. As a workaround, we could add the following logic to the standalone application launcher on Mac:

    if (isMac && !keepAlive) {
        if (error) { ex.printStackTrace(); }
        System.exit(0);
    }

where keepAlive is set based on a System property, for example: -Djavafx.keepalive=true

Comments
Must be related to RT-14096 : Mac: Fx Application to receive CmdQ
12-08-2011

If I click the red window button apps close normally. If I hit Cmd+Q there's debug output/exception and the app doesn't terminate. I've tried BrickBreaker and WebMap.
12-08-2011

Works for me on the following sample apps in experiments ( running in or outside of Netbeans): BrickBreaker, ColorfulCircles, DigitalClock, DisplayShelf, Ensemble, PathAnimation and SwingJavaFXChar. Can you provide us when more information?
12-08-2011

I can still reproduce this. When closing sample apps I get [java] Java has been detached already, but someone is still trying to use it at -[GlassRunnable run]:/Users/pz71691/work/fx/ws/glass/glass-mat-lib-macosx/src/com/sun/mat/ui/GlassApplication.m:148 [java] Java has been detached already, but someone is still trying to use it at -[GlassRunnable dealloc]:/Users/pz71691/work/fx/ws/glass/glass-mat-lib-macosx/src/com/sun/mat/ui/GlassApplication.m:160 or when running from inside Netbeans Glass detected outstanding Java exception at _GlassTimerTask:/Users/pz71691/work/fx/ws/glass/glass-mat-lib-macosx/src/com/sun/mat/ui/GlassTimer.m:48 Exception in thread "Glass Timer Thread" java.lang.RuntimeException: Main Java thread is detached. at com.sun.glass.ui.mac.MacApplication._postOnEventQueue(Native Method) at com.sun.glass.ui.Application.postOnEventQueue(Application.java:184) at com.sun.javafx.tk.quantum.QuantumToolkit$11.run(QuantumToolkit.java:342)
09-08-2011

Fixed. Changeset: 9c80c42b1e7a Author: Chien Yang <chien.yang@oracle.com> Date: Mon Aug 08 11:13:12 2011 -0700 URL: http://jfxsrc.us.oracle.com/javafx/presidio/scrum/graphics/runtime/rev/9c80c42b1e7a
08-08-2011

Attached a patch with the proposed solution.
03-08-2011