Ticket #624 (closed task: fixed)

Opened 8 years ago

Last modified 8 years ago

Close IJ2 Display when an IJ1 plugin closes IJ1 ImagePlus/ImageWIndow

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

Description

As part of the Display <--> ImagePlus support in the legacy layer: we need to close the IJ2 display associated with an IJ1 ImageWindow/ImagePlus if ImageWindow::close() is called by a plugin.

I have put the framework in place and will further document where the changes need to happen as part of the Display <--> ImagePlus mapping.

Change History

comment:1 Changed 8 years ago by bdezonia

ImageWindowMethods:close() is where the update needs to be made. There is skeleton code present that needs to be enabled. Note that inside the skeleton is a call to display.close() which does not exist so some additional support will be needed here.

comment:2 Changed 8 years ago by bdezonia

Note that this scenario is the problem the ImageWindowMethods::close() code is trying to address:

Make new Hyperstack of 1 channel and 3 slices. Run Stack to Images. IJ1 plugin wants to delete the original Display. Thats what the ImageWIndowMethods::close() needs to do. Then after running plugin you should have 3 images and the original displayed dataset gone.

As it is now the original Display does not go away. However when you do close it you get a null ptr exception in the guts of IJ1 trying to close it (when IJ1 thinks its already gone).

comment:3 Changed 8 years ago by bdezonia

One last thing to note: we must avoid stack blowups in this code. I do not know if this will be the case but here is a theoretical scenario.

IJ1 plugin deletes the working ImagePlus' window. This is captured by ImageWindowMethods::close(). Which closes the current Display. Which creates DatasetDeletedEvent. Which the LegacyImageMap catches. Which tries to unregister the Dataset. Which finds parallel ImagePlus, gets its window, and tries to close it again. Which could blow up stack.

Maybe I'm wrong about this sequence of events. Or maybe the ImageWindowMethods::close() command just needs to check if the window has already closed first.

comment:4 Changed 8 years ago by bdezonia

I thought this was done.

comment:5 Changed 8 years ago by curtis

  • Owner changed from curtis to bdezonia
  • Status changed from new to assigned

Calling File > Close works on images originally from IJ1 (e.g., File > Open Samples > Blobs). But if it was initially an IJ2 image (e.g., File > New > Image [IJ2]) then Close still fails.

comment:6 Changed 8 years ago by bdezonia

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

File Close and File Close All issues fixed with changes 2de032fab20582a00ac6a96cb8f0893abae40eb2 and c4b8407a19898c644ecc9a099ad6dfb1917c6bf2.

I think this ticket is complete.

Note: See TracTickets for help on using tickets.