{
// 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)