QReadWriteLock: fix another data race in stateForWaitCondition()

The writerCount member variable is only ever accessed under
Private::mutex protection, so we need to lock the mutex here, too.

Pick-to: 6.3 6.2 5.15
Change-Id: I1717e5282eed2ecc14ccdc5090b9fc41174cccc8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2022-05-13 18:21:01 +02:00
parent ff053b39a3
commit 0ca2cf42e0
1 changed files with 1 additions and 0 deletions

View File

@ -422,6 +422,7 @@ QReadWriteLock::StateForWaitCondition QReadWriteLock::stateForWaitCondition() co
if (!d)
return Unlocked;
const auto lock = qt_scoped_lock(d->mutex);
if (d->writerCount > 1)
return RecursivelyLocked;
else if (d->writerCount == 1)