parent
09ea733231
commit
bd0a3a86d9
@ -223,7 +223,7 @@ class Application(QApplication):
|
||||
if data:
|
||||
# Crashlog exists and has data in it, so something crashed
|
||||
# previously.
|
||||
self._crashdlg = crashdialog.FatalCrashDialog(
|
||||
self._crashdlg = crashdialog.get_fatal_crash_dialog(
|
||||
self._args.debug, data)
|
||||
self._crashdlg.show()
|
||||
else:
|
||||
|
@ -30,10 +30,10 @@ import traceback
|
||||
from PyQt5.QtCore import pyqtSlot, Qt, QSize, qVersion
|
||||
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
|
||||
QVBoxLayout, QHBoxLayout, QCheckBox,
|
||||
QDialogButtonBox)
|
||||
QDialogButtonBox, QMessageBox)
|
||||
|
||||
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.browser.network import pastebin
|
||||
from qutebrowser.config import config
|
||||
@ -63,6 +63,35 @@ def parse_fatal_stacktrace(text):
|
||||
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):
|
||||
|
||||
"""Dialog which gets shown after there was a crash.
|
||||
|
@ -110,7 +110,11 @@ def main():
|
||||
app = app.Application(args)
|
||||
|
||||
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
|
||||
|
||||
# We set qApp explicitely here to reduce the risk of segfaults while
|
||||
|
Loading…
Reference in New Issue
Block a user