Commit 757d5b1c authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen Committed by Jani Heikkinen
Browse files

Fix crash on exit with url-request interceptors


If the interceptor is the child of the profile, they will be deleted
with the API profile which is before the underlying browser-context,
they should therefore be unset from the browser context first.

Task-number: QTBUG-60236
Change-Id: I2954e8106863b8b421ef166f6bf8fa79240c95ee
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@qt.io>
Showing with 8 additions and 0 deletions
......@@ -162,6 +162,8 @@ QWebEngineUrlRequestInterceptor *BrowserContextAdapter::requestInterceptor()
void BrowserContextAdapter::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor)
{
if (m_requestInterceptor == interceptor)
return;
m_requestInterceptor = interceptor;
if (m_browserContext->url_request_getter_.get())
m_browserContext->url_request_getter_->updateRequestInterceptor();
......
......@@ -153,6 +153,8 @@ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<Brow
QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate()
{
m_browserContextRef->setRequestInterceptor(nullptr);
m_browserContextRef->removeClient(this);
Q_FOREACH (QQuickWebEngineDownloadItem* download, m_ongoingDownloads) {
......
......@@ -156,6 +156,10 @@ QWebEngineProfilePrivate::QWebEngineProfilePrivate(QSharedPointer<BrowserContext
QWebEngineProfilePrivate::~QWebEngineProfilePrivate()
{
// In the case the user sets this profile as the parent of the interceptor
// it can be deleted before the browser-context still referencing it is.
m_browserContextRef->setRequestInterceptor(nullptr);
delete m_settings;
m_settings = 0;
m_browserContextRef->removeClient(this);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment