|
Bugzilla – Bug 282 |
When quitting, Fiji does not prompt to save changes in non-image windows |
Last modified: 2011-03-23 15:00:43 CDT |
| ⚠ |
NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug. The Fiji project now uses GitHub Issues for issue tracking. Please file all new issues there. |
| When quitting, Fiji does not prompt to save changes in non-image windows | |
|
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
STEPS TO REPRODUCE 1) Start Fiji 2) Choose File > New > Script or File > New > Text Window 3) Type some text into the editor window that appears 4) Choose File > Quit (Fiji > Quit Fiji on Mac OS X works too) 5) Fiji will quit without prompting to save changes in the editor window REASON FOR THE BEHAVIOR 1) Performing File > Quit calls IJ.quit(). 2) IJ.quit() calls IJ.getInstance().quit(), which in turns spawns a new thread that invokes ij.ImageJ.run(). 3) The run method does the following: * Sets a "quitting" flag * Prompts "Are you sure you want to quit?" in certain circumstances (but none generally relevant to this issue) * Calls WindowManager.closeAllWindows(), and aborts if it returns false * Otherwise, performs various cleanup, then calls System.exit(0) 4) The closeAllWindows method does the following: * For each *image* window, aborts if that window refuses to close - When asked to close, an ImageWindow prompts the user if it has unsaved changes - If the user cancels, the ImageWindow declines to close * Signals the OK to quit if the "quitting" flag is true (which at this point, it always is) * Additional logic past that point is ignored in this case So, the problem is that when quitting, *non*-image windows are never queried to ensure they are OK with being shut down. This holds for both the Fiji Script Editor and ImageJ's built-in Text Editor. Further, even if the closeAllWindows method is modified to ignore the "quitting" flag and continue onward, testing non-image windows, there is still a problem: only ij.plugin.frame.PlugInFrame and ij.text.TextWindow objects are closed with close(). Everything else is closed with setVisible(false) and dispose(), with no recourse. And the aforementioned classes' close() methods also have no recourse to cancel anyway, since close() returns void.