diff options
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 11 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 4cf957089f..d153b2e4f9 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -678,7 +678,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object) will remain in the old thread when moveToThread() is called. \target No copy constructor - \section1 No copy constructor or assignment operator + \section1 No Copy Constructor or Assignment Operator QObject has neither a copy constructor nor an assignment operator. This is by design. Actually, they are declared, but in a @@ -723,7 +723,7 @@ void QMetaCallEvent::placeMetaCall(QObject *object) and both standard Qt widgets and user-created forms can be given dynamic properties. - \section1 Internationalization (i18n) + \section1 Internationalization (I18n) All QObject subclasses support Qt's translation features, making it possible to translate an application's user interface into different languages. @@ -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); diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 2d97cf5a6a..bdbd0dd8ef 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -442,7 +442,8 @@ protected: #ifndef QT_NO_DEBUG_STREAM friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &); #endif -#ifndef Q_NO_TEMPLATE_FRIENDS +// ### Qt6: FIXME: Remove the special Q_CC_MSVC handling, it was introduced to maintain BC for QTBUG-41810 . +#if !defined(Q_NO_TEMPLATE_FRIENDS) && !defined(Q_CC_MSVC) template<typename T> friend inline T qvariant_cast(const QVariant &); template<typename T> friend struct QtPrivate::QVariantValueHelper; |