diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-04-16 11:49:01 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-04-16 11:49:01 -0300 |
commit | 53fdcda3f487a371cc196451f85c74870fb3bf4b (patch) | |
tree | 54e0a108c47386c994e7a3bbd9b55379650d18c8 /src/leap | |
parent | 64e25fc8cf8a2f8c1fec6388e1f76312831b5f2a (diff) | |
parent | 6d3a9952cf713dc9bf70710ed04f5db7d7c98869 (diff) |
Merge remote-tracking branch 'chiiph/bug/properly_finish_qtapp' into develop
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/bitmask/gui/twisted_main.py | 14 |
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') |