summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-08-07 12:06:56 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-08-29 11:23:01 +0000
commitf559f0400ebd105ef048195e477248ff1f39f6e8 (patch)
tree20725f8552fb9bf5aca914a2ad636f74dac4677b /src
parentfa7928f2d0765ed08f3e51e2edaa46d32a95abfd (diff)
Close popup windows when their parents are destroyed
Previously when a popup window was shown, and the user issued a command to close the only active main window (via a shortcut for example) with a subsequent call to deleteLater(), the main window would be closed and deleted but the popup would only be hidden, which led to the application loop to still be running and not quitting, even though there would be no visible window left. The closing of a popup is usually done in the QWidget destructor when the popup is still visible, but because we unset the parent right before the parent is destroyed (which sets visibility to false), the popup would not be closed, but only hidden. Thus this change makes sure to explicitly close the popup when its parent is destroyed. Task-number: QTBUG-62311 Change-Id: Ia0bbf327929af55aac19767971ab0acde5715e21 Reviewed-by: Viktor Engelmann <viktor.engelmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp7
1 files changed, 7 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 6dd612999..d56f644d3 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -169,7 +169,14 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende
void RenderWidgetHostViewQtDelegateWidget::removeParentBeforeParentDelete()
{
+ // Unset the parent, because parent is being destroyed, but the owner of this
+ // RenderWidgetHostViewQtDelegateWidget is actually a RenderWidgetHostViewQt instance.
setParent(Q_NULLPTR);
+
+ // If this widget represents a popup window, make sure to close it, so that if the popup was the
+ // last visible top level window, the application event loop can quit if it deems it necessarry.
+ if (m_isPopup)
+ close();
}
void RenderWidgetHostViewQtDelegateWidget::initAsChild(WebContentsAdapterClient* container)