diff options
author | Christophe Chapuis <chris.chapuis@gmail.com> | 2016-09-04 14:37:57 +0000 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-09-20 13:17:57 +0000 |
commit | bfc2683ab4ca3f56a2effd1b2f7e68850acb72ba (patch) | |
tree | 43cf015059c78996f7b90dfe387e6efd19973885 /src | |
parent | 2057634462750fc7a6157600509044564c2f47fd (diff) |
Fix crash when using openIn on newly created view
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.
Task-number: QTBUG-55765
Change-Id: Ia1a299dd65c229705462c9444b81d7b26567fc09
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 6 |
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(); adapter->initialize(this); |