summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-08-15 08:56:27 +0200
committerMichael BrĂ¼ning <michael.bruning@qt.io>2019-08-17 06:15:19 +0000
commitde16c27bfd3bf74a2588523dbd017fac833f90f5 (patch)
treec05acbb50171d61b584fa2d0c62325e069369d67
parentf7197bd7e106fb3dc875616e26a22e131ed733e4 (diff)
WebContentsAdapter: don't use toStrongRef().data()
It's an anti-pattern. Even though we don't expect other threads to destroy the last QSP while we use the pointer obtained from QWeakPointer, play it safe and use QWeakPointer idiomatically: as a non-owning reference, to be converted to an owning one for the duration of our use of the payload object. Amends 7cade5688f6a0bde067dc496cedcb8de14662116. Change-Id: Ib1c136569c27f413a4a78bfc35784032c53522a9 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r--src/core/web_contents_adapter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 052a71905..2831ec159 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -694,7 +694,7 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request)
}
auto navigate = [](QWeakPointer<WebContentsAdapter> weakAdapter, const content::NavigationController::LoadURLParams &params) {
- WebContentsAdapter *adapter = weakAdapter.toStrongRef().data();
+ const auto adapter = weakAdapter.toStrongRef();
if (!adapter)
return;
adapter->webContents()->GetController().LoadURLWithParams(params);