diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2020-05-21 16:28:02 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2020-05-25 10:58:37 +0200 |
commit | 17cac776b2ec30af8f928d648f4708f8e1a25b5e (patch) | |
tree | 96b49c7542443d9de158f5187437628c4a2e1dc6 /src/core | |
parent | 7b6d15cdf271772695d28bf48f1f41a29dc29e28 (diff) |
Fix crash on WebContentsDelegateQt::CloseContents()
CloseContents() triggers a windowCloseRequested() signal. The handler of
the signal might close the QWebEngineView and it would result the
destruction of the WebContentsDelegateQt. Thus, any operation on
WebContentsDelegateQt is not safe after a
WebContentsAdapterClient::close() call.
For example, calling QWebEngineView::close() on
QWebEnginePage::windowCloseRequested() would result crash because it
sets life cycle state to discarded which destructs web contents.
Fixes: QTBUG-84355
Change-Id: I5da404bc9b1923cc19085ee899b550da49d1416b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index bf0254e82..63f52433e 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -251,8 +251,9 @@ void WebContentsDelegateQt::AddNewContents(content::WebContents* source, std::un void WebContentsDelegateQt::CloseContents(content::WebContents *source) { - m_viewClient->close(); GetJavaScriptDialogManager(source)->CancelDialogs(source, /* whatever?: */false); + // Must be the last call because close() might trigger the destruction of this object. + m_viewClient->close(); } void WebContentsDelegateQt::LoadProgressChanged(double progress) |