From e51bde44ef65ad1e3527468a749a6ea600ac93c8 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 8 Jan 2021 15:44:06 +0000 Subject: [PATCH] Shutdown: re-order the top level calls 1. The updater is in a thread/DLL and we don't want that firing part way through shutdown, so it gets asked to stop first. 2. Then plugins, so they're out of the way and we won't have already stopped something they might rely on. 3. Hotkey after that to head off the user triggering something via them. 4. Now stop the programmatic input from Journal files (including Status.json). 5. Frontier auth handling. 6. And then anything else. --- EDMarketConnector.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 155415d3..210186e3 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -1069,27 +1069,36 @@ class AppWindow(object): self.w.update_idletasks() logger.info('Starting shutdown procedures...') - logger.info('Closing protocol handler...') - protocolhandler.close() + # First so it doesn't interrupt us + logger.info('Closing update checker...') + self.updater.close() + # Earlier than anything else so plugin code can't interfere *and* it + # won't still be running in a manner that might rely on something + # we'd otherwise have already stopped. + logger.info('Notifying plugins to stop...') + plug.notify_stop() + + # Handling of application hotkeys now so the user can't possible cause + # an issue via triggering one. logger.info('Unregistering hotkey manager...') hotkeymgr.unregister() + # Now the main programmatic input methods logger.info('Closing dashboard...') dashboard.close() logger.info('Closing journal monitor...') monitor.close() - logger.info('Notifying plugins to stop...') - plug.notify_stop() - - logger.info('Closing update checker...') - self.updater.close() + # Frontier auth/CAPI handling + logger.info('Closing protocol handler...') + protocolhandler.close() logger.info('Closing Frontier CAPI sessions...') companion.session.close() + # Now anything else. logger.info('Closing config...') config.close()