summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread.cpp
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2018-06-01 10:33:08 +0200
committerLorn Potter <lorn.potter@gmail.com>2018-08-17 00:34:30 +0000
commit07f6eff58d5ffd8d148cd848141be1ba11c6c5da (patch)
treee37105f2b7c8dae610add9e1f35fb6c23368e82d /src/corelib/thread/qthread.cpp
parentd9d35b9fb6eef13b69d54c876a3b6f1c1b629704 (diff)
Correctly initialize adopted threads in stub implementation
Set data->threadId, which makes the thread detection used by Qt::AutoConnection work: it will now actually select Qt::DirectConnection. Change-Id: I9369e47eb7ed3ec88dba25f2d41e92139958bcd7 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/corelib/thread/qthread.cpp')
-rw-r--r--src/corelib/thread/qthread.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 472c6f6795..f784bf5cb6 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -778,7 +778,9 @@ QThreadData *QThreadData::current(bool createIfNecessary)
if (!data && createIfNecessary) {
data = new QThreadData;
data->thread = new QAdoptedThread(data);
+ data->threadId.store(Qt::HANDLE(data->thread));
data->deref();
+ data->isAdopted = true;
if (!QCoreApplicationPrivate::theMainThread)
QCoreApplicationPrivate::theMainThread = data->thread.load();
}