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.

Bug 3 - ij.ImageJ class is not a singleton
ij.ImageJ class is not a singleton
Status: RESOLVED WONTFIX
Product: Fiji
Classification: Unclassified
Component: ImageJ1
unspecified
PC Linux
: P2 blocker
Assigned To: Mark Longair
Depends on:
Blocks:
 
Reported: 2008-05-13 21:59 CDT by Albert Cardona
Modified: 2008-06-19 16:04 CDT
1 user (show)

See Also:

Description Albert Cardona 2008-05-13 21:59:39 CDT
From jython or any plugin etc., one can call:

ij.ImageJ()

which effectively opens a new ImageJ instance, with the following effects:
-The menu is stolen from the already running one
-When closed, ImageJ as a whole doesn't close
-After closing it, the regular ImageJ cannot be closed by closing the window; needs to be killed.

Proposed solution: make the class a singleton, with a private constructor.
Comment 1 Johannes Schindelin 2008-05-14 13:01:18 CDT
Hmpf.  I do not think that Wayne would take such a change.

In the meantime, you can work around by

  ImageJ ij = IJ.getInstance();
  return ij == null ? new ImageJ() : ij;
Comment 2 Johannes Schindelin 2008-05-14 13:08:22 CDT
FWIW I uploaded the branch "ij-singleton" to repo.or.cz.  Well, maybe I can talk Wayne into it.
Comment 3 Mark Longair 2008-06-19 16:04:12 CDT
OK, I'm closing this as WONTFIX, on the basis that at the moment it's likely to break compatability with ImageJ too much.