From b9257cead3f95e9a978d0e6ee456541a3c19ae7a Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Wed, 30 Dec 2015 18:53:38 +0000 Subject: [PATCH] Unregister hotkey on app exit on Windows. Hopefully fixes issues #68 and #69. --- EDMarketConnector.py | 1 + hotkey.py | 1 + 2 files changed, 2 insertions(+) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 15f17b21..4e81b269 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -481,6 +481,7 @@ class AppWindow: self.w.clipboard_append(self.station['text'] == self.STATION_UNDOCKED and self.system['text'] or '%s,%s' % (self.system['text'], self.station['text'])) def onexit(self, event=None): + hotkeymgr.unregister() flightlog.close() if platform!='darwin' or self.w.winfo_rooty()>0: # http://core.tcl.tk/tk/tktview/c84f660833546b1b84e7 config.set('geometry', '+{1}+{2}'.format(*self.w.geometry().split('+'))) diff --git a/hotkey.py b/hotkey.py index 270ec495..9d71a184 100644 --- a/hotkey.py +++ b/hotkey.py @@ -278,6 +278,7 @@ elif platform == 'win32': def unregister(self): if self.thread: PostThreadMessage(self.thread.ident, WM_QUIT, 0, 0) + self.thread.join() # Wait for it to unregister hotkey and quit self.thread = None def worker(self, keycode, modifiers):