diff options
authorChristophe Chapuis <>2016-09-04 14:37:57 +0000
committerJani Heikkinen <>2016-09-23 04:20:31 +0000
commitec84507898e58a167b185ba674acf300cc695380 (patch)
parent062b9bf3cf202b199892ca7bbe6d934c9b059022 (diff)
Fix crash when using openIn on newly created viewv5.6.2
When a link triggers a NewViewRequest, and the latter creates a new window with a new WebEngineView inside, the "adapter" pointer can still be NULL when the adoptWebContents is called by openIn. Therefore is it necessary to test the adapter pointer before using it. (cherry picked from commit bfc2683ab4ca3f56a2effd1b2f7e68850acb72ba) Task-number: QTBUG-55765 Change-Id: Iaa7cb4e8c7780a2e3f1a8c85b7b5da0ec541b2f3 Reviewed-by: Jani Heikkinen <>
1 files changed, 4 insertions, 2 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 68dfae145..4eca71926 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -755,8 +755,10 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
// This throws away the WebContentsAdapter that has been used until now.
// All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter.
- WebContentsAdapterOwner *adapterOwner = new WebContentsAdapterOwner(adapter->sharedFromThis());
- adapterOwner->deleteLater();
+ if (adapter) {
+ WebContentsAdapterOwner *adapterOwner = new WebContentsAdapterOwner(adapter->sharedFromThis());
+ adapterOwner->deleteLater();
+ }
adapter = webContents->sharedFromThis();