summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject.cpp
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2015-08-01 15:50:00 +0200
committerDavid Faure <david.faure@kdab.com>2015-09-22 07:55:03 +0000
commitec6556a2b99df373eb43ca009340a7f0f19bacbd (patch)
tree8bdcbf73f4d66a7d86d6c6afdfa93708b9ec34f7 /src/corelib/kernel/qobject.cpp
parent71df75966db5f51c66bff1c436dd1cb5a895b51b (diff)
Fix two data races in QThread/QThreadData
* theMainThread is written by the main thread and read by QThreadData::~QThreadData() (any managed thread) * QThreadData::thread is written by QThread::~QThread (in the parent thread) and read+written by QThreadData::~QThreadData (in the managed thread). This can happen because QThreadData is refcounted so the managed thread (which derefs it) races with the parent thread (which sets it to 0). Change-Id: I72de793716391a0937254cda6b4328fcad5060c7 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r--src/corelib/kernel/qobject.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index bcc4e7f8e6..f2c67fb3a0 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1468,7 +1468,7 @@ void QObject::moveToThread(QThread *targetThread)
} else if (d->threadData != currentData) {
qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n"
"Cannot move to target thread (%p)\n",
- currentData->thread, d->threadData->thread, targetData ? targetData->thread : Q_NULLPTR);
+ currentData->thread.load(), d->threadData->thread.load(), targetData ? targetData->thread.load() : Q_NULLPTR);
#ifdef Q_OS_MAC
qWarning("You might be loading two sets of Qt binaries into the same process. "