ejeschke / ginga

The Ginga astronomical FITS file viewer
BSD 3-Clause "New" or "Revised" License
121 stars 77 forks source link

Have the reference viewer stop all plugins before exit #972

Closed ejeschke closed 2 years ago

ejeschke commented 2 years ago

This PR modifies the reference viewer to stop all plugins that are running before exiting.

Mostly to make things terminate more cleanly if a plugin has some particular state, now stop() will be called on the plugin if it was activated at the time of the viewer closing.

ejeschke commented 2 years ago

@pllim, have a quick look when you have time. I don't think this one is too controversial.

ejeschke commented 2 years ago

Do you want me to manually test this out? Will I even notice anything?

You shouldn't notice anything. In any case, nothing about this is tested until you close the program. If you want, you might try opening a few of your plugins and then close the viewer, checking for any error messages from the plugin in the log.

This is more for specialty plugins that do something like open a socket or start a thread while they are open. Ginga might not exit cleanly if the stop() method is not called on the plugins to clean up/shut down this state. We have a couple of specialty ones like that and this is helpful to make sure things shut down cleanly.

ejeschke commented 2 years ago

Thank you @pllim, merging.