PKGBUILDs/extra/qt5-webengine/qtbug-76958.patch

32 lines
1.4 KiB
Diff
Raw Normal View History

2019-07-19 12:36:40 +00:00
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index c4f4591e..dc005b62 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -671,19 +671,23 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request)
}
}
- auto navigate = [](WebContentsAdapter *adapter, const content::NavigationController::LoadURLParams &params) {
+ auto navigate = [](QWeakPointer<WebContentsAdapter> weakAdapter, const content::NavigationController::LoadURLParams &params) {
+ WebContentsAdapter *adapter = weakAdapter.data();
+ if (!adapter)
+ return;
adapter->webContents()->GetController().LoadURLWithParams(params);
// Follow chrome::Navigate and invalidate the URL immediately.
adapter->m_webContentsDelegate->NavigationStateChanged(adapter->webContents(), content::INVALIDATE_TYPE_URL);
adapter->focusIfNecessary();
};
+ QWeakPointer<WebContentsAdapter> weakThis(sharedFromThis());
if (resizeNeeded) {
// Schedule navigation on the event loop.
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(navigate, this, std::move(params)));
+ base::BindOnce(navigate, std::move(weakThis), std::move(params)));
} else {
- navigate(this, params);
+ navigate(std::move(weakThis), params);
}
}