mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
32 lines
1.4 KiB
Diff
32 lines
1.4 KiB
Diff
|
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 ¶ms) {
|
||
|
+ auto navigate = [](QWeakPointer<WebContentsAdapter> weakAdapter, const content::NavigationController::LoadURLParams ¶ms) {
|
||
|
+ 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);
|
||
|
}
|
||
|
}
|
||
|
|