Move late shutdown logging out of QApplication.
This commit is contained in:
parent
246cff63ed
commit
9dd688095c
@ -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.qt import get_qt_args
|
||||||
from qutebrowser.utils.readline import ReadlineBridge
|
from qutebrowser.utils.readline import ReadlineBridge
|
||||||
from qutebrowser.utils.usertypes import Timer, KeyMode
|
from qutebrowser.utils.usertypes import Timer, KeyMode
|
||||||
from qutebrowser.utils.debug import trace_lines
|
|
||||||
|
|
||||||
|
|
||||||
class Application(QApplication):
|
class Application(QApplication):
|
||||||
@ -720,10 +719,3 @@ class Application(QApplication):
|
|||||||
# We use a singleshot timer to exit here to minimize the likelyhood of
|
# We use a singleshot timer to exit here to minimize the likelyhood of
|
||||||
# segfaults.
|
# segfaults.
|
||||||
QTimer.singleShot(0, partial(self.exit, status))
|
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)
|
|
||||||
|
@ -108,6 +108,7 @@ def main():
|
|||||||
earlyinit.check_rfc6266()
|
earlyinit.check_rfc6266()
|
||||||
# We do this import late as we need to fix harfbuzz first.
|
# We do this import late as we need to fix harfbuzz first.
|
||||||
from qutebrowser.app import Application
|
from qutebrowser.app import Application
|
||||||
|
from qutebrowser.utils.debug import trace_lines
|
||||||
import PyQt5.QtWidgets as QtWidgets
|
import PyQt5.QtWidgets as QtWidgets
|
||||||
app = Application(args)
|
app = Application(args)
|
||||||
# We set qApp explicitely here to reduce the risk of segfaults while
|
# 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.
|
# FIXME: We should do another attempt at contacting upstream about this.
|
||||||
QtWidgets.qApp = app
|
QtWidgets.qApp = app
|
||||||
ret = app.exec_()
|
ret = app.exec_()
|
||||||
|
if args.debug:
|
||||||
|
print("Now logging late shutdown.", file=sys.stderr)
|
||||||
|
trace_lines(True)
|
||||||
QtWidgets.qApp = None
|
QtWidgets.qApp = None
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
Reference in New Issue
Block a user