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>
This commit is contained in:
Morten Johan Sørvig 2018-06-01 10:33:08 +02:00 committed by Lorn Potter
parent d9d35b9fb6
commit 07f6eff58d

View File

@ -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();
}