Don't clear page in WebView:shutdown. Fixes #99.

It seems Qt still wants to access the page (for the mousePressEvent) and
segfaults when we clear the page before that's finished.

We now try it inside __del__ like done in the link mentioned in the comment.
This commit is contained in:
Florian Bruhin 2014-10-15 18:03:48 +02:00
parent 74839d7aff
commit 348bc7147f

View File

@ -127,6 +127,13 @@ class WebView(QWebView):
url = utils.elide(self.url().toDisplayString(), 50)
return utils.get_repr(self, tab_id=self.tab_id, url=url)
def __del__(self):
# Explicitely releasing the page here seems to prevent some segfaults
# when quitting.
# Copied from:
# https://code.google.com/p/webscraping/source/browse/webkit.py#325
self.setPage(None)
def _set_load_status(self, val):
"""Setter for load_status."""
if not isinstance(val, LoadStatus):
@ -261,11 +268,6 @@ class WebView(QWebView):
settings.setAttribute(QWebSettings.JavascriptEnabled, False)
self.stop()
self.page().networkAccessManager().shutdown()
# Explicitely releasing the page here seems to prevent some segfaults
# when quitting.
# Copied from:
# https://code.google.com/p/webscraping/source/browse/webkit.py#325
self.setPage(None)
def openurl(self, url):
"""Open a URL in the browser.