parent
09ea733231
commit
bd0a3a86d9
@ -223,7 +223,7 @@ class Application(QApplication):
|
|||||||
if data:
|
if data:
|
||||||
# Crashlog exists and has data in it, so something crashed
|
# Crashlog exists and has data in it, so something crashed
|
||||||
# previously.
|
# previously.
|
||||||
self._crashdlg = crashdialog.FatalCrashDialog(
|
self._crashdlg = crashdialog.get_fatal_crash_dialog(
|
||||||
self._args.debug, data)
|
self._args.debug, data)
|
||||||
self._crashdlg.show()
|
self._crashdlg.show()
|
||||||
else:
|
else:
|
||||||
|
@ -30,10 +30,10 @@ import traceback
|
|||||||
from PyQt5.QtCore import pyqtSlot, Qt, QSize, qVersion
|
from PyQt5.QtCore import pyqtSlot, Qt, QSize, qVersion
|
||||||
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
|
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
|
||||||
QVBoxLayout, QHBoxLayout, QCheckBox,
|
QVBoxLayout, QHBoxLayout, QCheckBox,
|
||||||
QDialogButtonBox)
|
QDialogButtonBox, QMessageBox)
|
||||||
|
|
||||||
import qutebrowser
|
import qutebrowser
|
||||||
from qutebrowser.utils import version, log, utils, objreg
|
from qutebrowser.utils import version, log, utils, objreg, qtutils
|
||||||
from qutebrowser.misc import miscwidgets
|
from qutebrowser.misc import miscwidgets
|
||||||
from qutebrowser.browser.network import pastebin
|
from qutebrowser.browser.network import pastebin
|
||||||
from qutebrowser.config import config
|
from qutebrowser.config import config
|
||||||
@ -63,6 +63,35 @@ def parse_fatal_stacktrace(text):
|
|||||||
return (m.group(1), m.group(2))
|
return (m.group(1), m.group(2))
|
||||||
|
|
||||||
|
|
||||||
|
def get_fatal_crash_dialog(debug, data):
|
||||||
|
"""Get a fatal crash dialog based on a crash log.
|
||||||
|
|
||||||
|
If the crash is a segfault in qt_mainloop and we're on an old Qt version
|
||||||
|
this is a simple error dialog which lets the user know they should upgrade
|
||||||
|
if possible.
|
||||||
|
|
||||||
|
If it's anything else, it's a normal FatalCrashDialog with the possibility
|
||||||
|
to report the crash.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
debug: Whether the debug flag (--debug) was given.
|
||||||
|
data: The crash log data.
|
||||||
|
"""
|
||||||
|
errtype, frame = parse_fatal_stacktrace(data)
|
||||||
|
if (qtutils.version_check('5.4') or errtype != 'Segmentation fault' or
|
||||||
|
frame != 'qt_mainloop'):
|
||||||
|
return FatalCrashDialog(debug, data)
|
||||||
|
else:
|
||||||
|
title = "qutebrowser was restarted after a fatal crash!"
|
||||||
|
text = ("<b>qutebrowser was restarted after a fatal crash!</b><br/>"
|
||||||
|
"Unfortunately, this crash occured in Qt (the library "
|
||||||
|
"qutebrowser uses), and your version ({}) is outdated - "
|
||||||
|
"Qt 5.4 or later is recommended. Unfortuntately Debian and "
|
||||||
|
"Ubuntu don't ship a newer version (yet?)...".format(
|
||||||
|
qVersion()))
|
||||||
|
return QMessageBox(QMessageBox.Critical, title, text, QMessageBox.Ok)
|
||||||
|
|
||||||
|
|
||||||
class _CrashDialog(QDialog):
|
class _CrashDialog(QDialog):
|
||||||
|
|
||||||
"""Dialog which gets shown after there was a crash.
|
"""Dialog which gets shown after there was a crash.
|
||||||
|
@ -110,7 +110,11 @@ def main():
|
|||||||
app = app.Application(args)
|
app = app.Application(args)
|
||||||
|
|
||||||
def qt_mainloop():
|
def qt_mainloop():
|
||||||
"""Simple wrapper to get a nicer stack trace for segfaults."""
|
"""Simple wrapper to get a nicer stack trace for segfaults.
|
||||||
|
|
||||||
|
WARNING: misc/crashdialog.py checks the stacktrace for this function
|
||||||
|
name, so if this is changed, it should be changed there as well!
|
||||||
|
"""
|
||||||
return app.exec_() # pylint: disable=maybe-no-member
|
return app.exec_() # pylint: disable=maybe-no-member
|
||||||
|
|
||||||
# We set qApp explicitely here to reduce the risk of segfaults while
|
# We set qApp explicitely here to reduce the risk of segfaults while
|
||||||
|
Loading…
Reference in New Issue
Block a user