From de16c27bfd3bf74a2588523dbd017fac833f90f5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 15 Aug 2019 08:56:27 +0200 Subject: WebContentsAdapter: don't use toStrongRef().data() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/core/web_contents_adapter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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 weakAdapter, const content::NavigationController::LoadURLParams ¶ms) { - WebContentsAdapter *adapter = weakAdapter.toStrongRef().data(); + const auto adapter = weakAdapter.toStrongRef(); if (!adapter) return; adapter->webContents()->GetController().LoadURLWithParams(params); -- cgit v1.2.3