electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit deb5a262dae0a5759a6fe40e13d990b62cf409d2
parent 6ccd4b78008ae81ed39a9591721679ba446e4883
Author: ThomasV <thomasv@electrum.org>
Date:   Sat, 30 Dec 2017 16:50:15 +0100

Merge pull request #3626 from SomberNight/qt_quit_after_last_window

fix #3217: make sure qt quits
Diffstat:
Mgui/qt/__init__.py | 25+++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py @@ -240,6 +240,7 @@ class ElectrumGui: except GoBack: return except: + import traceback traceback.print_exc(file=sys.stdout) return self.timer.start() @@ -248,11 +249,23 @@ class ElectrumGui: if not self.start_new_window(path, self.config.get('url')): return signal.signal(signal.SIGINT, lambda *args: self.app.quit()) + + def quit_after_last_window(): + # on some platforms, not only does exec_ not return but not even + # aboutToQuit is emitted (but following this, it should be emitted) + if self.app.quitOnLastWindowClosed(): + self.app.quit() + self.app.lastWindowClosed.connect(quit_after_last_window) + + def clean_up(): + # Shut down the timer cleanly + self.timer.stop() + # clipboard persistence. see http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg17328.html + event = QtCore.QEvent(QtCore.QEvent.Clipboard) + self.app.sendEvent(self.app.clipboard(), event) + self.tray.hide() + self.app.aboutToQuit.connect(clean_up) + # main loop self.app.exec_() - # Shut down the timer cleanly - self.timer.stop() - # clipboard persistence. see http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg17328.html - event = QtCore.QEvent(QtCore.QEvent.Clipboard) - self.app.sendEvent(self.app.clipboard(), event) - self.tray.hide() + # on some platforms the exec_ call may not return, so use clean_up()