Move late shutdown logging out of QApplication.

This commit is contained in:
Florian Bruhin 2014-08-01 23:44:41 +02:00
parent 246cff63ed
commit 9dd688095c
2 changed files with 4 additions and 8 deletions

View File

@ -64,7 +64,6 @@ from qutebrowser.utils.misc import get_standard_dir, actute_warning
from qutebrowser.utils.qt import get_qt_args
from qutebrowser.utils.readline import ReadlineBridge
from qutebrowser.utils.usertypes import Timer, KeyMode
from qutebrowser.utils.debug import trace_lines
class Application(QApplication):
@ -720,10 +719,3 @@ class Application(QApplication):
# We use a singleshot timer to exit here to minimize the likelyhood of
# segfaults.
QTimer.singleShot(0, partial(self.exit, status))
def exit(self, status):
"""Override exit to trace late shutdown if requested."""
if self.args.debug:
log.destroy.debug("Now logging late shutdown.")
trace_lines(True)
super().exit(status)

View File

@ -108,6 +108,7 @@ def main():
earlyinit.check_rfc6266()
# We do this import late as we need to fix harfbuzz first.
from qutebrowser.app import Application
from qutebrowser.utils.debug import trace_lines
import PyQt5.QtWidgets as QtWidgets
app = Application(args)
# We set qApp explicitely here to reduce the risk of segfaults while
@ -118,5 +119,8 @@ def main():
# FIXME: We should do another attempt at contacting upstream about this.
QtWidgets.qApp = app
ret = app.exec_()
if args.debug:
print("Now logging late shutdown.", file=sys.stderr)
trace_lines(True)
QtWidgets.qApp = None
return ret