diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/configure.json | 4 | ||||
-rw-r--r-- | src/corelib/doc/snippets/events/events.cpp | 16 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qjnihelpers.cpp | 49 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 39 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary_unix.cpp | 30 | ||||
-rw-r--r-- | src/corelib/thread/qmutex_linux.cpp | 2 | ||||
-rw-r--r-- | src/corelib/thread/qreadwritelock_p.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthread.cpp | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthread_p.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 24 | ||||
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 4 |
13 files changed, 77 insertions, 101 deletions
diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 60248e9cd2..58b902c7ca 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -211,8 +211,7 @@ }, "dlopen": { "label": "dlopen()", - "condition": "tests.dlopen || libs.libdl", - "output": [ { "type": "define", "negative": true, "name": "QT_NO_DYNAMIC_LIBRARY" } ] + "condition": "tests.dlopen || libs.libdl" }, "libdl": { "label": "dlopen() in libdl", @@ -463,6 +462,7 @@ "label": "QLibrary", "purpose": "Provides a wrapper for dynamically loaded libraries.", "section": "File I/O", + "condition": "config.win32 || config.hpux || (!config.nacl && features.dlopen)", "output": [ "publicFeature", "feature" ] }, "settings": { diff --git a/src/corelib/doc/snippets/events/events.cpp b/src/corelib/doc/snippets/events/events.cpp index b029296bc2..9606b0c2ee 100644 --- a/src/corelib/doc/snippets/events/events.cpp +++ b/src/corelib/doc/snippets/events/events.cpp @@ -87,15 +87,15 @@ public: bool MyWidget::event(QEvent *event) { if (event->type() == QEvent::KeyPress) { - QKeyEvent *ke = static_cast<QKeyEvent *>(event); - if (ke->key() == Qt::Key_Tab) { - // special tab handling here - return true; - } + QKeyEvent *ke = static_cast<QKeyEvent *>(event); + if (ke->key() == Qt::Key_Tab) { + // special tab handling here + return true; + } } else if (event->type() == MyCustomEventType) { - MyCustomEvent *myEvent = static_cast<MyCustomEvent *>(event); - // custom event handling here - return true; + MyCustomEvent *myEvent = static_cast<MyCustomEvent *>(event); + // custom event handling here + return true; } return QWidget::event(event); diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index af485a1832..8da06f71f7 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2105,7 +2105,7 @@ On \macos, tool windows correspond to the \l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating} class of windows. This means that the window lives on a - level above normal windows; it impossible to put a normal + level above normal windows making it impossible to put a normal window on top of it. By default, tool windows will disappear when the application is inactive. This can be controlled by the Qt::WA_MacAlwaysShowToolWindow attribute. diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp index 091280400e..93bc477e7d 100644 --- a/src/corelib/kernel/qjnihelpers.cpp +++ b/src/corelib/kernel/qjnihelpers.cpp @@ -73,7 +73,7 @@ static jclass g_jNativeClass = Q_NULLPTR; static jmethodID g_runPendingCppRunnablesMethodID = Q_NULLPTR; static jmethodID g_hideSplashScreenMethodID = Q_NULLPTR; Q_GLOBAL_STATIC(std::deque<QtAndroidPrivate::Runnable>, g_pendingRunnables); -Q_GLOBAL_STATIC(QMutex, g_pendingRunnablesMutex); +static QBasicMutex g_pendingRunnablesMutex; class PermissionsResultClass : public QObject { @@ -88,21 +88,24 @@ private: typedef QHash<int, QSharedPointer<PermissionsResultClass>> PendingPermissionRequestsHash; Q_GLOBAL_STATIC(PendingPermissionRequestsHash, g_pendingPermissionRequests); -Q_GLOBAL_STATIC(QMutex, g_pendingPermissionRequestsMutex); -Q_GLOBAL_STATIC(QAtomicInt, g_requestPermissionsRequestCode); +static QBasicMutex g_pendingPermissionRequestsMutex; +static int nextRequestCode() +{ + static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(0); + return counter.fetchAndAddRelaxed(1); +} // function called from Java from Android UI thread static void runPendingCppRunnables(JNIEnv */*env*/, jobject /*obj*/) { for (;;) { // run all posted runnables - g_pendingRunnablesMutex->lock(); + QMutexLocker locker(&g_pendingRunnablesMutex); if (g_pendingRunnables->empty()) { - g_pendingRunnablesMutex->unlock(); break; } QtAndroidPrivate::Runnable runnable(std::move(g_pendingRunnables->front())); g_pendingRunnables->pop_front(); - g_pendingRunnablesMutex->unlock(); + locker.unlock(); runnable(); // run it outside the sync block! } } @@ -122,16 +125,17 @@ Q_GLOBAL_STATIC(GenericMotionEventListeners, g_genericMotionEventListeners) static void sendRequestPermissionsResult(JNIEnv *env, jobject /*obj*/, jint requestCode, jobjectArray permissions, jintArray grantResults) { - g_pendingPermissionRequestsMutex->lock(); + QMutexLocker locker(&g_pendingPermissionRequestsMutex); auto it = g_pendingPermissionRequests->find(requestCode); if (it == g_pendingPermissionRequests->end()) { - g_pendingPermissionRequestsMutex->unlock(); // show an error or something ? return; } - g_pendingPermissionRequestsMutex->unlock(); + auto request = std::move(*it); + g_pendingPermissionRequests->erase(it); + locker.unlock(); - Qt::ConnectionType connection = QThread::currentThread() == it.value()->thread() ? Qt::DirectConnection : Qt::BlockingQueuedConnection; + Qt::ConnectionType connection = QThread::currentThread() == request->thread() ? Qt::DirectConnection : Qt::BlockingQueuedConnection; QtAndroidPrivate::PermissionsHash hash; const int size = env->GetArrayLength(permissions); std::unique_ptr<jint[]> results(new jint[size]); @@ -143,10 +147,7 @@ static void sendRequestPermissionsResult(JNIEnv *env, jobject /*obj*/, jint requ QtAndroidPrivate::PermissionsResult::Denied; hash[permission] = value; } - QMetaObject::invokeMethod(it.value().data(), "sendResult", connection, Q_ARG(QtAndroidPrivate::PermissionsHash, hash)); - g_pendingPermissionRequestsMutex->lock(); - g_pendingPermissionRequests->erase(it); - g_pendingPermissionRequestsMutex->unlock(); + QMetaObject::invokeMethod(request.data(), "sendResult", connection, Q_ARG(QtAndroidPrivate::PermissionsHash, hash)); } static jboolean dispatchGenericMotionEvent(JNIEnv *, jclass, jobject event) @@ -403,7 +404,7 @@ jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env) return JNI_ERR; g_runPendingCppRunnablesMethodID = env->GetStaticMethodID(jQtNative, - "runPendingCppRunnablesOnUiThread", + "runPendingCppRunnablesOnAndroidThread", "()V"); g_hideSplashScreenMethodID = env->GetStaticMethodID(jQtNative, "hideSplashScreen", "()V"); g_jNativeClass = static_cast<jclass>(env->NewGlobalRef(jQtNative)); @@ -459,10 +460,10 @@ void QtAndroidPrivate::runOnUiThread(QRunnable *runnable, JNIEnv *env) void QtAndroidPrivate::runOnAndroidThread(const QtAndroidPrivate::Runnable &runnable, JNIEnv *env) { - g_pendingRunnablesMutex->lock(); + QMutexLocker locker(&g_pendingRunnablesMutex); const bool triggerRun = g_pendingRunnables->empty(); g_pendingRunnables->push_back(runnable); - g_pendingRunnablesMutex->unlock(); + locker.unlock(); if (triggerRun) env->CallStaticVoidMethod(g_jNativeClass, g_runPendingCppRunnablesMethodID); } @@ -487,18 +488,16 @@ void QtAndroidPrivate::requestPermissions(JNIEnv *env, const QStringList &permis return; } // Check API 23+ permissions - const int requestCode = (*g_requestPermissionsRequestCode)++; + const int requestCode = nextRequestCode(); if (!directCall) { - g_pendingPermissionRequestsMutex->lock(); + QMutexLocker locker(&g_pendingPermissionRequestsMutex); (*g_pendingPermissionRequests)[requestCode] = QSharedPointer<PermissionsResultClass>::create(callbackFunc); - g_pendingPermissionRequestsMutex->unlock(); } runOnAndroidThread([permissions, callbackFunc, requestCode, directCall] { if (directCall) { - g_pendingPermissionRequestsMutex->lock(); + QMutexLocker locker(&g_pendingPermissionRequestsMutex); (*g_pendingPermissionRequests)[requestCode] = QSharedPointer<PermissionsResultClass>::create(callbackFunc); - g_pendingPermissionRequestsMutex->unlock(); } QJNIEnvironmentPrivate env; @@ -519,8 +518,10 @@ QHash<QString, QtAndroidPrivate::PermissionsResult> QtAndroidPrivate::requestPer *res = result; sem->release(); }, true); - sem->tryAcquire(1, timeoutMs); - return *res; + if (sem->tryAcquire(1, timeoutMs)) + return std::move(*res); + else // mustn't touch *res + return QHash<QString, QtAndroidPrivate::PermissionsResult>(); } QtAndroidPrivate::PermissionsResult QtAndroidPrivate::checkPermission(const QString &permission) diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 5623b085b8..1764c8116e 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -834,38 +834,27 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp, const char *QMetaType::typeName(int typeId) { const uint type = typeId; - // In theory it can be filled during compilation time, but for some reason template code - // that is able to do it causes GCC 4.6 to generate additional 3K of executable code. Probably - // it is not worth of it. - static const char *namesCache[QMetaType::HighestInternalId + 1]; - - const char *result; - if (type <= QMetaType::HighestInternalId && ((result = namesCache[type]))) - return result; - #define QT_METATYPE_TYPEID_TYPENAME_CONVERTER(MetaTypeName, TypeId, RealName) \ - case QMetaType::MetaTypeName: result = #RealName; break; + case QMetaType::MetaTypeName: return #RealName; break; switch (QMetaType::Type(type)) { QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_TYPEID_TYPENAME_CONVERTER) - - default: { - if (Q_UNLIKELY(type < QMetaType::User)) { - return 0; // It can happen when someone cast int to QVariant::Type, we should not crash... - } else { - const QVector<QCustomTypeInfo> * const ct = customTypes(); - QReadLocker locker(customTypesLock()); - return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() - ? ct->at(type - QMetaType::User).typeName.constData() - : 0; - } + case QMetaType::UnknownType: + case QMetaType::User: + break; } + + if (Q_UNLIKELY(type < QMetaType::User)) { + return nullptr; // It can happen when someone cast int to QVariant::Type, we should not crash... } -#undef QT_METATYPE_TYPEID_TYPENAME_CONVERTER - Q_ASSERT(type <= QMetaType::HighestInternalId); - namesCache[type] = result; - return result; + const QVector<QCustomTypeInfo> * const ct = customTypes(); + QReadLocker locker(customTypesLock()); + return ct && uint(ct->count()) > type - QMetaType::User && !ct->at(type - QMetaType::User).typeName.isEmpty() + ? ct->at(type - QMetaType::User).typeName.constData() + : nullptr; + +#undef QT_METATYPE_TYPEID_TYPENAME_CONVERTER } /* diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 8088b18ef4..8e906b278d 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3708,7 +3708,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i continue; QObject * const receiver = c->receiver; - const bool receiverInSameThread = currentThreadId == receiver->d_func()->threadData->threadId; + const bool receiverInSameThread = currentThreadId == receiver->d_func()->threadData->threadId.load(); // determine if this connection should be sent immediately or // put into the event queue diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index bb7874071e..3553763bcd 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -50,13 +50,9 @@ # include <private/qcore_mac_p.h> #endif -#if (defined(Q_OS_VXWORKS) && !defined(VXWORKS_RTP)) || defined (Q_OS_NACL) -#define QT_NO_DYNAMIC_LIBRARY -#endif - QT_BEGIN_NAMESPACE -#if !defined(QT_HPUX_LD) && !defined(QT_NO_DYNAMIC_LIBRARY) +#if !defined(QT_HPUX_LD) QT_BEGIN_INCLUDE_NAMESPACE #include <dlfcn.h> QT_END_INCLUDE_NAMESPACE @@ -64,9 +60,7 @@ QT_END_INCLUDE_NAMESPACE static QString qdlerror() { -#if defined(QT_NO_DYNAMIC_LIBRARY) - const char *err = "This platform does not support dynamic libraries."; -#elif !defined(QT_HPUX_LD) +#if !defined(QT_HPUX_LD) const char *err = dlerror(); #else const char *err = strerror(errno); @@ -131,7 +125,6 @@ QStringList QLibraryPrivate::prefixes_sys() bool QLibraryPrivate::load_sys() { QString attempt; -#if !defined(QT_NO_DYNAMIC_LIBRARY) QFileSystemEntry fsEntry(fileName); QString path = fsEntry.path(); @@ -250,7 +243,6 @@ bool QLibraryPrivate::load_sys() } } #endif -#endif // QT_NO_DYNAMIC_LIBRARY if (!pHnd) { errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror()); } @@ -263,29 +255,27 @@ bool QLibraryPrivate::load_sys() bool QLibraryPrivate::unload_sys() { -#if !defined(QT_NO_DYNAMIC_LIBRARY) -# if defined(QT_HPUX_LD) +#if defined(QT_HPUX_LD) if (shl_unload((shl_t)pHnd)) { -# else +#else if (dlclose(pHnd)) { -# endif -# if defined (Q_OS_QNX) // Workaround until fixed in QNX; fixes crash in +#endif +#if defined (Q_OS_QNX) // Workaround until fixed in QNX; fixes crash in char *error = dlerror(); // QtDeclarative auto test "qqmlenginecleanup" for instance if (!qstrcmp(error, "Shared objects still referenced")) // On QNX that's only "informative" return true; errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName, QLatin1String(error)); -# else +#else errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName, qdlerror()); -# endif +#endif return false; } -#endif errorString.clear(); return true; } -#if defined(Q_OS_LINUX) && !defined(QT_NO_DYNAMIC_LIBRARY) +#if defined(Q_OS_LINUX) Q_CORE_EXPORT QFunctionPointer qt_linux_find_symbol_sys(const char *symbol) { return QFunctionPointer(dlsym(RTLD_DEFAULT, symbol)); @@ -305,8 +295,6 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) QFunctionPointer address = 0; if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0) address = 0; -#elif defined (QT_NO_DYNAMIC_LIBRARY) - QFunctionPointer address = 0; #else QFunctionPointer address = QFunctionPointer(dlsym(pHnd, symbol)); #endif diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp index 17072f44d4..5f6e74ac6f 100644 --- a/src/corelib/thread/qmutex_linux.cpp +++ b/src/corelib/thread/qmutex_linux.cpp @@ -107,8 +107,6 @@ QT_BEGIN_NAMESPACE * waiting in the past. We then set the mutex to 0x0 and perform a FUTEX_WAKE. */ -static QBasicAtomicInt futexFlagSupport = Q_BASIC_ATOMIC_INITIALIZER(-1); - static inline int _q_futex(void *addr, int op, int val, const struct timespec *timeout) Q_DECL_NOTHROW { volatile int *int_addr = reinterpret_cast<volatile int *>(addr); diff --git a/src/corelib/thread/qreadwritelock_p.h b/src/corelib/thread/qreadwritelock_p.h index bb58dfab56..04dd45a2e1 100644 --- a/src/corelib/thread/qreadwritelock_p.h +++ b/src/corelib/thread/qreadwritelock_p.h @@ -74,7 +74,7 @@ public: int writerCount; int waitingReaders; int waitingWriters; - bool recursive; + const bool recursive; //Called with the mutex locked bool lockForWrite(int timeout); diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index c8777cac82..0828400733 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE */ QThreadData::QThreadData(int initialRefCount) - : _ref(initialRefCount), loopLevel(0), scopeLevel(0), thread(0), threadId(0), + : _ref(initialRefCount), loopLevel(0), scopeLevel(0), eventDispatcher(0), quitNow(false), canWait(true), isAdopted(false), requiresCoreApplication(true) { diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 37eca9c612..885b4c0c1e 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -284,7 +284,7 @@ public: QStack<QEventLoop *> eventLoops; QPostEventList postEventList; QAtomicPointer<QThread> thread; - Qt::HANDLE threadId; + QAtomicPointer<void> threadId; QAtomicPointer<QAbstractEventDispatcher> eventDispatcher; QVector<void *> tls; FlaggedDebugSignatures flaggedSignatures; diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index c60742631b..f359d25a73 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -255,7 +255,7 @@ QThreadData *QThreadData::current(bool createIfNecessary) } data->deref(); data->isAdopted = true; - data->threadId = to_HANDLE(pthread_self()); + data->threadId.store(to_HANDLE(pthread_self())); if (!QCoreApplicationPrivate::theMainThread) QCoreApplicationPrivate::theMainThread = data->thread.load(); } @@ -335,7 +335,7 @@ void *QThreadPrivate::start(void *arg) thr->d_func()->setPriority(QThread::Priority(thr->d_func()->priority & ~ThreadPriorityResetFlag)); } - data->threadId = to_HANDLE(pthread_self()); + data->threadId.store(to_HANDLE(pthread_self())); set_thread_data(data); data->ref(); @@ -352,7 +352,7 @@ void *QThreadPrivate::start(void *arg) // sets the name of the current thread. QString objectName = thr->objectName(); - pthread_t thread_id = from_HANDLE<pthread_t>(data->threadId); + pthread_t thread_id = from_HANDLE<pthread_t>(data->threadId.load()); if (Q_LIKELY(objectName.isEmpty())) setCurrentThreadName(thread_id, thr->metaObject()->className()); else @@ -651,7 +651,7 @@ void QThread::start(Priority priority) #endif code = pthread_create(&threadId, &attr, QThreadPrivate::start, this); } - d->data->threadId = to_HANDLE(threadId); + d->data->threadId.store(to_HANDLE(threadId)); pthread_attr_destroy(&attr); @@ -660,7 +660,7 @@ void QThread::start(Priority priority) d->running = false; d->finished = false; - d->data->threadId = 0; + d->data->threadId.store(nullptr); } } @@ -670,10 +670,10 @@ void QThread::terminate() Q_D(QThread); QMutexLocker locker(&d->mutex); - if (!d->data->threadId) + if (!d->data->threadId.load()) return; - int code = pthread_cancel(from_HANDLE<pthread_t>(d->data->threadId)); + int code = pthread_cancel(from_HANDLE<pthread_t>(d->data->threadId.load())); if (code) { qWarning("QThread::start: Thread termination error: %s", qPrintable(qt_error_string((code)))); @@ -686,7 +686,7 @@ bool QThread::wait(unsigned long time) Q_D(QThread); QMutexLocker locker(&d->mutex); - if (from_HANDLE<pthread_t>(d->data->threadId) == pthread_self()) { + if (from_HANDLE<pthread_t>(d->data->threadId.load()) == pthread_self()) { qWarning("QThread::wait: Thread tried to wait on itself"); return false; } @@ -728,7 +728,7 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority) int sched_policy; sched_param param; - if (pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId), &sched_policy, ¶m) != 0) { + if (pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId.load()), &sched_policy, ¶m) != 0) { // failed to get the scheduling policy, don't bother setting // the priority qWarning("QThread::setPriority: Cannot get scheduler parameters"); @@ -744,15 +744,15 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority) } param.sched_priority = prio; - int status = pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId), sched_policy, ¶m); + int status = pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId.load()), sched_policy, ¶m); # ifdef SCHED_IDLE // were we trying to set to idle priority and failed? if (status == -1 && sched_policy == SCHED_IDLE && errno == EINVAL) { // reset to lowest priority possible - pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId), &sched_policy, ¶m); + pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId.load()), &sched_policy, ¶m); param.sched_priority = sched_get_priority_min(sched_policy); - pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId), sched_policy, ¶m); + pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId.load()), sched_policy, ¶m); } # else Q_UNUSED(status); diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index e6c70ecb55..ef7bfc511d 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -137,7 +137,7 @@ QThreadData *QThreadData::current(bool createIfNecessary) } threadData->deref(); threadData->isAdopted = true; - threadData->threadId = reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())); + threadData->threadId.store(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId()))); if (!QCoreApplicationPrivate::theMainThread) { QCoreApplicationPrivate::theMainThread = threadData->thread.load(); @@ -351,7 +351,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi qt_create_tls(); TlsSetValue(qt_current_thread_data_tls_index, data); - data->threadId = reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())); + data->threadId.store(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId()))); QThread::setTerminationEnabled(false); |