diff --git a/qutebrowser/misc/crashdialog.py b/qutebrowser/misc/crashdialog.py index f8b37c742..3d50e5f29 100644 --- a/qutebrowser/misc/crashdialog.py +++ b/qutebrowser/misc/crashdialog.py @@ -57,17 +57,22 @@ def parse_fatal_stacktrace(text): element being the first stacktrace frame. """ lines = [ - r'Fatal Python error: (.*)', + r'(?PFatal Python error|Windows fatal exception): (?P.*)', r' *', r'(Current )?[Tt]hread [^ ]* \(most recent call first\): *', - r' File ".*", line \d+ in (.*)', + r' File ".*", line \d+ in (?P.*)', ] m = re.match('\n'.join(lines), text) if m is None: # We got some invalid text. return ('', '') else: - return (m.group(1), m.group(3)) + msg = m.group('msg') + typ = m.group('type') + func = m.group('func') + if typ == 'Windows fatal exception': + msg = 'Windows ' + msg + return msg, func def _get_environment_vars(): @@ -474,7 +479,8 @@ class FatalCrashDialog(_CrashDialog): self._type, self._func = parse_fatal_stacktrace(self._log) def _get_error_type(self): - if self._type == 'Segmentation fault': + if self._type in ['Segmentation fault', + 'Windows access violation']: return 'segv' else: return self._type @@ -522,7 +528,7 @@ class FatalCrashDialog(_CrashDialog): """Prevent empty reports.""" if (not self._info.toPlainText().strip() and not self._contact.toPlainText().strip() and - self._type == 'Segmentation fault' and + self._get_error_type() == 'segv' and self._func == 'qt_mainloop'): msgbox.msgbox(parent=self, title='Empty crash info', text="Empty reports for fatal crashes are useless " diff --git a/tests/unit/misc/test_crashdialog.py b/tests/unit/misc/test_crashdialog.py index 89ca342ee..8bb34045c 100644 --- a/tests/unit/misc/test_crashdialog.py +++ b/tests/unit/misc/test_crashdialog.py @@ -47,6 +47,14 @@ Thread 0x00007fa135ac7700 (most recent call first): File "", line 1 in testfunc """ +WINDOWS_CRASH_TEXT = """ +Windows fatal exception: access violation +_ +Current thread 0x000014bc (most recent call first): + File "qutebrowser\mainwindow\tabbedbrowser.py", line 468 in tabopen + File "qutebrowser\browser\shared.py", line 247 in get_tab +""" + INVALID_CRASH_TEXT = """ Hello world! """ @@ -56,6 +64,7 @@ Hello world! (VALID_CRASH_TEXT, 'Segmentation fault', 'testfunc'), (VALID_CRASH_TEXT_THREAD, 'Segmentation fault', 'testfunc'), (VALID_CRASH_TEXT_EMPTY, 'Aborted', ''), + (WINDOWS_CRASH_TEXT, 'Windows access violation', 'tabopen'), (INVALID_CRASH_TEXT, '', ''), ]) def test_parse_fatal_stacktrace(text, typ, func):