Work around crashes when opening URL after renderer crash

Fixes #2290
This commit is contained in:
Florian Bruhin 2017-02-08 10:55:42 +01:00
parent 2469d01ce7
commit 1af951fd62
3 changed files with 26 additions and 3 deletions

View File

@ -61,6 +61,7 @@ Fixed
- Fixed starting on newer PyQt/sip versions with LibreSSL
- When downloading files with QtWebKit, a User-Agent header is set when possible.
- Fixed showing of keybindings in the :help completion
- Worked around a segfault when opening a URL after a QtWebEngine renderer process crash
v0.9.1
------

View File

@ -250,12 +250,13 @@ class TabbedBrowser(tabwidget.TabWidget):
url = config.get('general', 'default-page')
self.openurl(url, newtab=True)
def _remove_tab(self, tab, *, add_undo=True):
def _remove_tab(self, tab, *, add_undo=True, crashed=False):
"""Remove a tab from the tab list and delete it properly.
Args:
tab: The QWebView to be closed.
add_undo: Whether the tab close can be undone.
crashed: Whether we're closing a tab with crashed renderer process.
"""
idx = self.indexOf(tab)
if idx == -1:
@ -285,8 +286,10 @@ class TabbedBrowser(tabwidget.TabWidget):
urlutils.invalid_url_error(tab.url(), "saving tab")
tab.shutdown()
self.removeTab(idx)
tab.layout().unwrap()
tab.deleteLater()
if not crashed:
# WORKAROUND for a segfault when we delete the crashed tab.
# see https://bugreports.qt.io/browse/QTBUG-58698
tab.layout().unwrap()
def undo(self):
"""Undo removing of a tab."""
@ -671,6 +674,12 @@ class TabbedBrowser(tabwidget.TabWidget):
else:
raise ValueError("Invalid status {}".format(status))
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-58698
# FIXME:qtwebengine can we disable this with Qt 5.8.1?
self._remove_tab(tab, crashed=True)
if self.count() == 0:
self.tabopen(QUrl('about:blank'))
def resizeEvent(self, e):
"""Extend resizeEvent of QWidget to emit a resized signal afterwards.

View File

@ -653,3 +653,16 @@ Feature: Various utility commands.
Scenario: Renderer kill
When I run :open -t chrome://kill
Then the error "Renderer process was killed" should be shown
# https://github.com/qutebrowser/qutebrowser/issues/2290
@qtwebkit_skip @no_invalid_lines
Scenario: Navigating to URL after renderer process is gone
When I run :tab-only
And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab
And I run :open chrome://kill
And I wait for "Renderer process was killed" in the log
And I open data/numbers/3.txt
Then no crash should happen
And the following tabs should be open:
- data/numbers/3.txt (active)