modules/graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java

Print this page

        

@@ -242,11 +242,14 @@
          * Glass Mac, X11 need Application.setDeviceDetails to happen prior to Glass Application.Run
          */
         renderer = QuantumRenderer.getInstance();
         collector = PaintCollector.createInstance(this);
         pipeline = GraphicsPipeline.getPipeline();
-        if (PrismSettings.shutdownHook) {
+
+        /* shutdown the pipeline on System.exit, ^c
+         * needed with X11 and Windows, see RT-32501
+         */
             shutdownHook = new Thread("Glass/Prism Shutdown Hook") {
                 @Override public void run() {
                     dispose();
                 }
             };

@@ -254,11 +257,10 @@
                 @Override public Void run() {
                     Runtime.getRuntime().addShutdownHook(shutdownHook);
                     return null;
                 }
             });
-        }
         return true;
     }
 
     /**
      * This method is invoked by PlatformImpl. It is typically called on the main

@@ -676,11 +678,10 @@
         Application.invokeLater(runnable);
     }
 
     @Override public void exit() {
             notifyShutdownHooks();
-            pulseTimer.stop();
 
             ViewPainter.renderLock.lock();
             try {
                 //TODO - should update glass scene view state
                 //TODO - doesn't matter because we are exiting

@@ -695,21 +696,20 @@
             super.exit();
 }
 
     public void dispose() {
         if (toolkitRunning.compareAndSet(true, false)) {
+            pulseTimer.stop();
             renderer.stopRenderer();
 
-            if (PrismSettings.shutdownHook) {
                 try {
                     Runtime.getRuntime().removeShutdownHook(shutdownHook);
                 } catch (IllegalStateException ignore) {
                     // throw when shutdown hook already removed
                 }
             }
         }
-    }
 
     @Override public boolean isForwardTraversalKey(KeyEvent e) {
         return (e.getCode() == KeyCode.TAB)
                    && (e.getEventType() == KeyEvent.KEY_PRESSED)
                    && !e.isShiftDown();