JAL-4090 blocker patch JAL-3772 tidy up groovy console when closed rather than callin...
authorJames Procter <j.procter@dundee.ac.uk>
Wed, 15 Nov 2023 14:54:31 +0000 (14:54 +0000)
committerJames Procter <j.procter@dundee.ac.uk>
Wed, 15 Nov 2023 14:54:31 +0000 (14:54 +0000)
src/jalview/gui/Desktop.java

index a2a344c..35c7818 100644 (file)
@@ -1518,7 +1518,21 @@ public class Desktop extends jalview.jbgui.GDesktop
     {
       // suppress a possible repeat prompt to save script
       groovyConsole.setDirty(false);
-      groovyConsole.exit();
+
+      // and tidy up
+      if (((Window) groovyConsole.getFrame()) != null
+              && ((Window) groovyConsole.getFrame()).isVisible())
+      {
+        // console is visible -- FIXME JAL-4327
+        groovyConsole.exit();
+      }
+      else
+      {
+        // console is not, so just let it dispose itself when we shutdown
+        // we don't call groovyConsole.exit() because it calls the shutdown
+        // handler with invokeAndWait() causing deadlock
+        groovyConsole = null;
+      }
     }
 
     if (terminateJvm)