diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2016-08-31 18:13:28 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@theqtcompany.com> | 2016-08-31 18:13:28 +0200 |
commit | 3cc148853f0f7468526df9dd2397a70a8eeeedae (patch) | |
tree | 64abd86c07654a52ee44ba9ace28ca0455721704 /src/webenginewidgets/api | |
parent | 74b324b8f328e9d241984de6a9c43825fa298aff (diff) | |
parent | 44f41d30ed3efce2f1970dcd158555b41b38014d (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ic739ab9db0851cc13467168840ea2549996432f8
Diffstat (limited to 'src/webenginewidgets/api')
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index e4b10faa6..10b4452fb 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -297,9 +297,14 @@ void QWebEnginePagePrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> ne if (newPage->d_func() == this) { // If createWindow returns /this/ we must delay the adoption. Q_ASSERT(q == newPage); - QTimer::singleShot(0, q, [this, newPage, newWebContents, initialGeometry] () { - adoptNewWindowImpl(newPage, newWebContents, initialGeometry); - }); + // WebContents might be null if we just opened a new page for navigation, in that case + // avoid referencing newWebContents so that it is deleted and WebContentsDelegateQt::OpenURLFromTab + // will fall back to navigating current page. + if (newWebContents->webContents()) { + QTimer::singleShot(0, q, [this, newPage, newWebContents, initialGeometry] () { + adoptNewWindowImpl(newPage, newWebContents, initialGeometry); + }); + } } else { adoptNewWindowImpl(newPage, newWebContents, initialGeometry); } |