From dd96a62fca461dd4227947469d99f59f9358c028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 20 Feb 2018 15:58:00 +0100 Subject: Fix focusObjectDuringDestruction crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t assume that there is an active modal widget on QApplication::focusChanged(). That signal can also be emitted on focus clear during dialog destruction. Task-number: QTBUG-66536 Change-Id: I20c64339c56a52b39c26a7683b62779deba576d9 Reviewed-by: Tor Arne Vestbø --- tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 05410f4a0f..69621a6c09 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -1521,7 +1521,8 @@ public: const QWindow *window = QGuiApplication::topLevelWindows().constFirst(); const QFileDialog *fileDialog = qobject_cast(QApplication::activeModalWidget()); - QVERIFY(fileDialog); + if (!fileDialog) + return; // The problem in QTBUG-57193 was from a platform input context plugin that was // connected to QWindow::focusObjectChanged(), and consequently accessed the focus -- cgit v1.2.3