From bf28e2fc133c8d9f966cd2db51f7c76928395e0d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 24 Sep 2014 15:08:09 +0200 Subject: [PATCH] Do not re-create windows during application shutdown Change 9c3a58a913a7e59359146264ee59d40d703d4db2 causes any window to be re-created when the screen it is shown on is destroyed. This is for the use case of detaching one monitor while another remains. In QWindow::setScreen(), if the screen is null, it will be set to the primary screen. However during application shutdown, it may be that the primary screen has been destroyed before all the windows are destroyed; so trying to set it anyway will cause a crash. qtdeclarative/tests/auto/quick/qquickwindow was segfaulting, especially when running testWindowVisibilityOrder by itself. Change-Id: Ice6b30320ac563f0c70264aa5c57de21d2e4d56e Reviewed-by: Friedemann Kleint --- src/gui/kernel/qwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index f52e12c6a8..af3b27fd10 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1697,7 +1697,7 @@ void QWindow::setScreen(QScreen *newScreen) void QWindow::screenDestroyed(QObject *object) { Q_D(QWindow); - if (d->parentWindow) + if (d->parentWindow || QGuiApplication::closingDown()) return; if (object == static_cast(d->topLevelScreen)) { const bool wasVisible = isVisible();