NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #1856 (closed defect: invalid)

Opened 2013-05-08T16:27:44-05:00

Last modified 2014-05-01T12:24:27-05:00

A exit hack

Reported by: bdezonia Owned by: curtis
Priority: major Milestone: imagej2-b8-analysis
Component: Core Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1457


In order to always exit safely even if plugin writers do not dispose their windows correctly we can have a catch all close routine. Thus, though hacky, we can avoid System.exit(). I have created such a hacky hack on the exit-hack branch.

Change History

comment:1 Changed 2013-05-08T16:28:22-05:00 by bdezonia

  • Blocking 1563 added

comment:2 Changed 2013-06-04T11:43:39-05:00 by bdezonia

  • Blocking 1457 added; 1563 removed
  • Milestone changed from imagej2-b7-ndim-data to imagej2-b8-analysis

comment:3 Changed 2014-05-01T12:24:27-05:00 by curtis

  • Status changed from new to closed
  • Resolution set to invalid

The main purpose of avoiding System.exit is to avoid touching state within the JVM that doesn't "belong" to ImageJ. Unfortunately, iterating through all open windows would potentially affect "non-ImageJ" objects within the JVM. While it is conceivable we could somehow listen for all window creations and determine whether each one is "ImageJ-related" and then dispose only those, it would be a lot of work just to work around other people's bugs.

For quitting, if we are going to end up touching global state anyway, I'd rather ImageJ just call System.exit(0) since it is much simpler. There is also a user option for whether to call System.exit IIRC. In any case, this hack unfortunately won't do the job.