Shut down NetworkManager before deleting WebPage.
Now that the QWebPage actually is a parent of the QNetworkAccessManager, first setting the page to None and then deleting the QNetworkAccessManager will get us a RuntimeError because the underlying C++ object is already gone.
This commit is contained in:
parent
7813f8f0c2
commit
892c02268a
@ -278,14 +278,12 @@ class WebView(QWebView):
|
|||||||
settings = self.settings()
|
settings = self.settings()
|
||||||
settings.setAttribute(QWebSettings.JavascriptEnabled, False)
|
settings.setAttribute(QWebSettings.JavascriptEnabled, False)
|
||||||
self.stop()
|
self.stop()
|
||||||
nam = self.page().networkAccessManager()
|
self.page().networkAccessManager().shutdown()
|
||||||
# Explicitely releasing the page here seems to prevent some segfaults
|
# Explicitely releasing the page here seems to prevent some segfaults
|
||||||
# when quitting.
|
# when quitting.
|
||||||
# Copied from:
|
# Copied from:
|
||||||
# https://code.google.com/p/webscraping/source/browse/webkit.py#325
|
# https://code.google.com/p/webscraping/source/browse/webkit.py#325
|
||||||
self.setPage(None)
|
self.setPage(None)
|
||||||
nam.shutdown()
|
|
||||||
del nam
|
|
||||||
|
|
||||||
def openurl(self, url):
|
def openurl(self, url):
|
||||||
"""Open a URL in the browser.
|
"""Open a URL in the browser.
|
||||||
|
Loading…
Reference in New Issue
Block a user