From a90349aa2141767147498d8f6a6d69dc25af89bc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Nov 2024 09:38:37 -0800 Subject: [PATCH] QCoreApplication: remove now-unnecessary thread affinity check Partially reverts commit 65953e05d3d9aefd158d4073820083155aaae5e4 (the rest will be addressed in the next commit) now that we have an atomic access to the QCoreApplication instance. This thread-affinity check code was there because the code had a data race in accessing QCoreApplication::self. It ensured that we only read that variable if the receiver was in the main thread, because if a receiver is not in the main thread, then it can't be QCoreApplication. Pick-to: 6.8 Change-Id: I09618961cca80fef2dc1fffdab65316164023207 Reviewed-by: Ivan Solovev --- src/corelib/kernel/qcoreapplication.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 68e2f2140ac..0dad8aa1f19 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1255,9 +1255,7 @@ bool QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject *receiv bool QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *receiver, QEvent *event) { - if ((receiver->d_func()->threadData.loadRelaxed()->thread.loadAcquire() != mainThread() - || receiver != qApp) - && receiver->d_func()->extraData) { + if (receiver != qApp && receiver->d_func()->extraData) { for (qsizetype i = 0; i < receiver->d_func()->extraData->eventFilters.size(); ++i) { QObject *obj = receiver->d_func()->extraData->eventFilters.at(i); if (!obj)