tQT: Stop timer cleanly to avoid exceptions on exit - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit 2226667437634bd45b40290084ad97e9895bbd08 (DIR) parent e1c0298fc29b171b1300076c7ec57fe5bf01707a (HTM) Author: Neil Booth <kyuupichan@gmail.com> Date: Sun, 20 Dec 2015 16:15:33 +0900 QT: Stop timer cleanly to avoid exceptions on exit Diffstat: M gui/qt/__init__.py | 3 +++ M gui/qt/util.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) --- (DIR) diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py t@@ -245,6 +245,9 @@ class ElectrumGui: # 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) (DIR) diff --git a/gui/qt/util.py b/gui/qt/util.py t@@ -61,11 +61,16 @@ class WaitingDialog(QThread): class Timer(QThread): + stopped = False + def run(self): - while True: + while not self.stopped: self.emit(SIGNAL('timersignal')) time.sleep(0.5) + def stop(self): + self.stopped = True + self.wait() class EnterButton(QPushButton): def __init__(self, text, func):