Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8088859

[Mac] Cannot exit FX application while file chooser is opened

XMLWordPrintable

      If you invoke Platform.exit while a FileChooser is opened, the application does not quit properly :
      - application window is dismissed but FileChooser is still there
      - if you click on the cancel button of the file chooser, the file chooser window is dismissed BUT the process is still alive and an exception is thrown (see below). At this time, you have to Force quit the app.

      Simple Test.java attached to reproduce.

      Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = JavaFX Application Thread
      at com.sun.glass.ui.Application.checkEventThread(Application.java:427)
      at com.sun.glass.ui.EventLoop.leave(EventLoop.java:159)
      at com.sun.glass.ui.mac.MacApplication._enterNestedEventLoopImpl(Native Method)
      at com.sun.glass.ui.mac.MacApplication._enterNestedEventLoop(MacApplication.java:113)
      at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:495)
      at com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
      at com.sun.glass.ui.mac.MacCommonDialogs._showFileOpenChooser(Native Method)
      at com.sun.glass.ui.mac.MacCommonDialogs.showFileChooser_impl(MacCommonDialogs.java:59)
      at com.sun.glass.ui.mac.MacApplication.staticCommonDialogs_showFileChooser(MacApplication.java:264)
      at com.sun.glass.ui.CommonDialogs.showFileChooser(CommonDialogs.java:212)
      at com.sun.javafx.tk.quantum.QuantumToolkit.showFileChooser(QuantumToolkit.java:1424)
      at javafx.stage.FileChooser.showDialog(FileChooser.java:416)
      at javafx.stage.FileChooser.showOpenMultipleDialog(FileChooser.java:373)
      at tests.Test$2.handle(Test.java:48)
      at tests.Test$2.handle(Test.java:43)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
      at javafx.event.Event.fireEvent(Event.java:204)
      at javafx.scene.Node.fireEvent(Node.java:8175)
      at javafx.scene.control.Button.fire(Button.java:185)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:204)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
      at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:314)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:345)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:526)
      at com.sun.glass.ui.View.notifyMouse(View.java:898)

            Unassigned Unassigned
            slions Sandra Lions-piron
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Imported: