Fix multiple emission of QGuiApplication::lastWindowClosed() when native child widgets are used

Run the handling in QWindowPrivate::maybeQuitOnLastWindowClosed()
for top level windows only.

Fixes: QTBUG-73061
Change-Id: I74deb50b06a64e8ef0e438d2abf14888f778a46e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2019-01-15 16:38:01 +01:00
parent 8961493b40
commit b782004149

View File

@ -2588,6 +2588,8 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed()
return;
Q_Q(QWindow);
if (!q->isTopLevel())
return;
// Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent
bool quitOnClose = QGuiApplication::quitOnLastWindowClosed() && !q->parent();
QWindowList list = QGuiApplication::topLevelWindows();