From ff484b3111c8982012ae91a1eb6f17746800235a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Jan 2025 11:06:38 -0300 Subject: [PATCH] tst_QApplication: test quit() not ::exit() from an event loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends Qt 4.8 commit 8dd8db250d92521fda619bdcf3e1c859b37b2da0. The report in QTBUG-12673 says "quit()" and the backtrace clearly shows the issue was attempting to cleanly exit the event loop while a modal dialog was showing. The test instead tested ::exit(). That was actually an important test because nothing else in the Qt test suite was testing this, but now it's included in the exitFromEventLoop() test for QCoreApplication, QGuiApplication, and QApplication. Task-number: QTBUG-12673 Change-Id: Ie7bd19af7103f3066b10fffda299d1168c8f677e Reviewed-by: Tor Arne Vestbø Reviewed-by: Fabian Kosmale --- tests/auto/widgets/kernel/qapplication/modal/base.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/kernel/qapplication/modal/base.cpp b/tests/auto/widgets/kernel/qapplication/modal/base.cpp index 49a90723dd4..31a752091c3 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/base.cpp +++ b/tests/auto/widgets/kernel/qapplication/modal/base.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "base.h" +#include "qapplication.h" base::base(QWidget *parent) : QWidget(parent) @@ -15,7 +16,7 @@ base::base(QWidget *parent) : void base::periodicTimer() { if(m_modalStarted) - exit(0); + qApp->quit(); m_modalDialog = new QDialog(this); m_modalDialog->setWindowTitle(QLatin1String("modal")); m_modalDialog->setModal(true);