tst_QApplication: test quit() not ::exit() from an event loop

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ø <tor.arne.vestbo@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Thiago Macieira 2025-01-10 11:06:38 -03:00
parent 010ed17884
commit ff484b3111

View File

@ -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);