summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2024-03-21 09:30:18 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2024-04-29 23:11:04 +0200
commit159ea47e2fc8ec7225db4feed3cb8926fbb93fc2 (patch)
tree28ec5320991c34bbe6c5ff0d6d55ae77a6f48529 /tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
parentde0f145022456db5f4242fe8689ef40bca7275e0 (diff)
QThread: Reuse isMainThread()
Internally, reuse threadId and theMainThreadId. Change-Id: Iea6e7d8fcbcaf7e2f4dbf8ab33890d0f7954edc0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp')
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 0745ea6ceb..8f8ab33e64 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -1041,7 +1041,7 @@ void tst_QCoreApplication::addRemoveLibPaths()
static bool theMainThreadIsSet()
{
// QCoreApplicationPrivate::mainThread() has a Q_ASSERT we'd trigger
- return QCoreApplicationPrivate::theMainThread.loadRelaxed() != nullptr;
+ return QCoreApplicationPrivate::theMainThreadId.loadRelaxed() != nullptr;
}
static bool theMainThreadWasUnset = !theMainThreadIsSet(); // global static
@@ -1053,8 +1053,8 @@ void tst_QCoreApplication::theMainThread()
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
TestApplication app(argc, argv);
- QVERIFY(QCoreApplicationPrivate::theMainThread.loadRelaxed());
- QCOMPARE(QCoreApplicationPrivate::theMainThread.loadRelaxed(), thread());
+ QVERIFY(QCoreApplicationPrivate::theMainThreadId.loadRelaxed());
+ QVERIFY(QThread::isMainThread());
QCOMPARE(app.thread(), thread());
QCOMPARE(app.thread(), QThread::currentThread());
}
@@ -1067,7 +1067,7 @@ static void createQObjectOnDestruction()
#if !defined(QT_QGUIAPPLICATIONTEST) && !defined(Q_OS_WIN)
// QCoreApplicationData's global static destructor has run and cleaned up
- // the QAdoptedThrad.
+ // the QAdoptedThread.
if (theMainThreadIsSet())
qFatal("theMainThreadIsSet() returned true; some QObject must have leaked");
#endif