tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Properly dispose of contexts

Open hinerm opened this issue 10 years ago • 2 comments

Currently none of the tutorials dispose the Contexts they create. I'm worried that this will lead to "ImageJ tutorials won't quit" issues. For example: run the LoadAndDisplayDataset tutorial - after closing the opened image and log, imagej will still be running.

hinerm avatar Dec 19 '14 19:12 hinerm

It is possible that we could solve this as a higher level... I assume it is still due to the polling thread set up by SCIFIO... but I couldn't come up with a better solution last time I tried, and I feel like maybe the tutorials are a good place to talk about context disposal anyway..?

hinerm avatar Dec 19 '14 19:12 hinerm

For non-interactive tutorials, calling context.dispose() at the end is probably the correct thing to do.

For interactive tutorials, the UI comes up and they'll have to choose Quit or close the window anyway in order to quit, which should dispose the context.

The only tricky scenario is if an image window pops up without the main UI being shown—then what?

ctrueden avatar Dec 19 '14 19:12 ctrueden