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 <ivan.solovev@qt.io>
This commit is contained in:
Thiago Macieira 2024-11-12 09:38:37 -08:00
parent 7d92ecd917
commit a90349aa21

View File

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