Ticket #1043 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

IJ2 doesn't always close images and exceptions can arise

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b1-initial
Component: Legacy Compatibility Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking:

Description

Open blobs (shift cmd b)
Zoom in (cmd =)
Close blobs (cmd w) - but it doesn't actually close
Open blobs again (shift cmd b)
Exception throw: (below)

I believe the issue is that the close is not closing the IJ2 display but is closing and deleting the associated ImagePlus in IJ1. The next time you run a legacy plugin LegacyPlugin tries to harmonize all Displays with their ImagePluses. The unclosed display must have a bad reference to its associated ImagePlus.

java.lang.NullPointerException

at imagej.legacy.translate.LegacyUtils.dimensionsIJ1Compatible(LegacyUtils.java:121)
at imagej.legacy.plugin.LegacyPlugin.isLegacyCompatible(LegacyPlugin.java:316)
at imagej.legacy.plugin.LegacyPlugin.run(LegacyPlugin.java:111)
at imagej.ext.plugin.PluginModule.run(PluginModule.java:150)
at imagej.ext.module.ModuleRunner.run(ModuleRunner.java:148)
at imagej.ext.module.ModuleRunner.call(ModuleRunner.java:118)
at imagej.ext.module.ModuleRunner.call(ModuleRunner.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Change History

comment:1 Changed 7 years ago by bdezonia

Okay, its not stale/closed ImagePlus issues. Its that since the window did not close when it should IJ2 thinks there is an active display and yet that active display has a null dataset associated with it. Must make sure the close actually closes the display and sets active display appropriately.

comment:2 Changed 7 years ago by curtis

Addressing ticket #995 may fix this bug.

comment:3 Changed 7 years ago by bdezonia

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

In 2ac9f2bf56dee339aee4adae5b81a95806320ab2 made sure windows close and also that active display is tracked better.

comment:4 Changed 7 years ago by bdezonia

Note that while fixing this ticket I changed the handling of window close / display deleted events.

WindowClosingEvents call display.close() and nothing else.

display.close() generates a DisplayDeletedEvent

Others listen for DisplayDeletedEvents and dispose of their resources.

The owner of the window closes it via window.close(). In the case where the user closed the window in the gui the later IJ2 call to window.close() causes a second display deleted event to be hatched. but it has no effect the second time.

Going forward we could avoid this double close behavior. We could have windows track their closed status and window.close() could only call dispose()/setVisible(false) if the window is not already closed.

Note: See TracTickets for help on using tickets.