summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2017-03-13 11:13:56 +0100
committerMichael BrĂ¼ning <michael.bruning@qt.io>2017-03-15 07:34:56 +0000
commit8e147ed3be7740092de233a2a7c67ec890069649 (patch)
tree4e049991e219e170473e48c77c41499042f23b8f /src/webenginewidgets
parent315e656efa99fce4ec9e822d428eed8af4fd1022 (diff)
Remove stale parent connection when initializing delegate as a child
When clicking on a blank link target, the constructor of the RenderWidgetHostViewQtDelegateWidget instance for the newly created view is called with the originating QWebEngineView as its parent and will connect its removeParentBeforeParentDelete slot to the originating view's destroyed signal. This leads to the situation where the delegate's parent will be set to null when the originating view is closed, causing the view to display only an empty widget with the actual web contents remaining live in the background. This patch removes the connection to the old view when initializing the delegate as a child of the QWebEnginePagePrivate instance. The addition to the layout updates the parent and child relationship between the view and the delegate internally. Task-number: QTBUG-58381 Change-Id: I448380478c2bcfcfbddaee8a35caf46010e57972 Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index e7ad5b107..14c4d72fe 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -163,6 +163,9 @@ void RenderWidgetHostViewQtDelegateWidget::initAsChild(WebContentsAdapterClient*
QWebEnginePagePrivate *pagePrivate = static_cast<QWebEnginePagePrivate *>(container);
if (pagePrivate->view) {
+ if (parentWidget())
+ disconnect(parentWidget(), &QObject::destroyed,
+ this, &RenderWidgetHostViewQtDelegateWidget::removeParentBeforeParentDelete);
pagePrivate->view->layout()->addWidget(this);
pagePrivate->view->setFocusProxy(this);
show();