summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2025-09-01 10:08:28 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2025-09-02 23:31:21 +0200
commit1df5b5d53aaa02b7de26f221b4a0ab8bf5360992 (patch)
treee7a6344b339455b4aa6585a3c605783baa269326 /src/corelib/thread/qthread.cpp
parent2e69afbc319f3653842bd99d5169b377af83a69c (diff)
QBindingStatus/QThread: Add missing synchronization
As the comment in qthread_p.h indicates, setStatusAndClearList requires external synchronization, otherwise we get data races. That was missinsg 2d92ea02501c058f55a8562f55804ccb105bf4bf, and gets fixed by this commit. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I63ca246964a85d5045b459cc17c8883dfa0ff914 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/thread/qthread.cpp')
-rw-r--r--src/corelib/thread/qthread.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 553b38fec8f..d544bc5258f 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -118,8 +118,11 @@ QAdoptedThread::QAdoptedThread(QThreadData *data)
#if QT_CONFIG(thread)
d_func()->threadState = QThreadPrivate::Running;
init();
- d_func()->data->m_statusOrPendingObjects.setStatusAndClearList(
+ {
+ QMutexLocker lock(&d_func()->mutex);
+ d_func()->data->m_statusOrPendingObjects.setStatusAndClearList(
QtPrivate::getBindingStatus({}));
+ }
#endif
// fprintf(stderr, "new QAdoptedThread = %p\n", this);
}