summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui/twisted_main.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask/gui/twisted_main.py')
-rw-r--r--src/leap/bitmask/gui/twisted_main.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/leap/bitmask/gui/twisted_main.py b/src/leap/bitmask/gui/twisted_main.py
index 1e876c57..ece32ca2 100644
--- a/src/leap/bitmask/gui/twisted_main.py
+++ b/src/leap/bitmask/gui/twisted_main.py
@@ -19,7 +19,8 @@ Main functions for integration of twisted reactor
"""
import logging
-from twisted.internet import error
+from twisted.internet import error, reactor
+from PySide import QtCore
# Resist the temptation of putting the import reactor here,
# it will raise an "reactor already imported" error.
@@ -27,6 +28,14 @@ from twisted.internet import error
logger = logging.getLogger(__name__)
+def stop():
+ logger.debug("Really stoping all the things...")
+ QtCore.QCoreApplication.sendPostedEvents()
+ QtCore.QCoreApplication.flush()
+ reactor.stop()
+ logger.debug("Done stopping all the things.")
+
+
def quit(app):
"""
Stop the mainloop.
@@ -34,9 +43,8 @@ def quit(app):
:param app: the main qt QApplication instance.
:type app: QtCore.QApplication
"""
- from twisted.internet import reactor
logger.debug('Stopping twisted reactor')
try:
- reactor.callLater(0, reactor.stop)
+ reactor.callLater(0, stop)
except error.ReactorNotRunning:
logger.debug('Reactor not running')