diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-10-01 16:21:12 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-10-01 16:21:12 +0200 |
commit | 8ee9774e67edf57d891528749a360a0af8f0c6f7 (patch) | |
tree | e0b7d4b19c26c48fe41e930532f2037f8dc43204 /src/corelib/kernel | |
parent | d78fb442d750b33afe2e41f31588ec94cf4023ad (diff) | |
parent | 8ab25620d3df25c43011ae982f4614639578afb3 (diff) |
Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 337ea7da3c..492031d7fe 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1465,14 +1465,14 @@ void QObject::moveToThread(QThread *targetThread) } QThreadData *currentData = QThreadData::current(); - QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : new QThreadData(0); + QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : Q_NULLPTR; if (d->threadData->thread == 0 && currentData == targetData) { // one exception to the rule: we allow moving objects with no thread affinity to the current thread currentData = d->threadData; } 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->thread); + currentData->thread, d->threadData->thread, targetData ? targetData->thread : Q_NULLPTR); #ifdef Q_OS_MAC qWarning("On Mac OS X, you might be loading two sets of Qt binaries into the same process. " @@ -1486,6 +1486,9 @@ void QObject::moveToThread(QThread *targetThread) // prepare to move d->moveToThread_helper(); + if (!targetData) + targetData = new QThreadData(0); + QOrderedMutexLocker locker(¤tData->postEventList.mutex, &targetData->postEventList.mutex); |