diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-04-28 17:47:57 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2016-04-30 03:00:33 +0000 |
commit | 112e53fdc4e46a5e94cb2d575d132e2015694407 (patch) | |
tree | 999de17175e00356d1a684b37a0298789a7eea62 /src/dbus | |
parent | 002112e80516a29efbb6cef721d74c5fc39fc19d (diff) |
Don't store the pthread_t thread ID twice in QThread
It was being stored once in QThreadPrivate and once in QThreadData, with
the latter being hidden as a Qt::HANDLE. Besides saving a little bit of
memory, this also solves a small data race condition that arises from
trying to connect a signal to an object moved to that thread and then
emit that signal shortly after the thread starts. Before this patch,
QThreadData::threadId was initialized only by QThreadPrivate::start(),
which meant that we were racing that initialization with this check in
QMetaObject::activate:
const bool receiverInSameThread = currentThreadId == receiver->d_func()->threadData->threadId;
Task-number: QTBUG-52337
Change-Id: Ifea6e497f11a461db432ffff1449ae01f1099aae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'src/dbus')
0 files changed, 0 insertions, 0 deletions