Skip to content

Fix data race in QObject::moveToThread()

We dereference thisThreadData in the next line, at a point in time where we haven't, yet, verified that it's this_thread's QThreadData, so we need an acquire fence.

The alternative would be to re-arrange the code so that dereferencing the pointer is delayed until after we verified it's this_thread's, but that doesn't seem readily possible.

Even if it was easy, we'd first need to verify whether there are any writes into QThreadData objects after they've been constructed, in which case the acquire fence may be needed even in case it's 'ours'.

So just add the acquire fence.

Pick-to: 6.3 6.2 5.15 Change-Id: I468bc1f971bd87345bfcd6c13b7384bdf09d086a Reviewed-by: Thiago Macieira thiago.macieira@intel.com (cherry picked from commit 5dc724d9)

Merge request reports