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

Print this page

        

@@ -335,12 +335,10 @@
             timerRunnable = () -> {
                 try {
                     QuantumToolkit.this.postPulse();
                 } catch (Throwable th) {
                     th.printStackTrace(System.err);
-                    // } catch (RuntimeException re) {
-                    // ignore spurious Glass timer events while exiting...
                 }
             };
             pulseTimer = Application.GetApplication().createTimer(timerRunnable);
 
             Application.GetApplication().setEventHandler(new Application.EventHandler() {

@@ -748,10 +746,13 @@
 
     @Override public void exit() {
         // This method must run on the FX application thread
         checkFxUserThread();
 
+        // Turn off pulses so no extraneous runnables are submitted
+        pulseTimer.stop();
+
         // We need to wait for the last frame to finish so that the renderer
         // is not running while we are shutting down glass.
         PaintCollector.getInstance().waitForRenderingToComplete();
 
         notifyShutdownHooks();

@@ -769,11 +770,10 @@
         super.exit();
     }
 
     public void dispose() {
         if (toolkitRunning.compareAndSet(true, false)) {
-            pulseTimer.stop();
             renderer.stopRenderer();
 
             try {
                 AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                     Runtime.getRuntime().removeShutdownHook(shutdownHook);