QFreeList: fix UB (data race) in release()
The load from _v[block] must acquire, to match the storeRelease() implied in the testAndSetRelease() in next(), where _v[block] was allocated. A loadReleaxed() will not establish the happens-before relation required to avoid a data race. So use loadAcquire(). Pick-to: 6.5 Change-Id: I34003ef7510a0d78f7851d2b4b4aab01a686babf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit b6faf63995b63d5958cf4b95ad1e9bab17d1bc6d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 6b89694a016474c7877ae07f0d49efd42f8fd9ec) (cherry picked from commit 51f2979e5f79e1d67425834167487d41bb59f9d7)
This commit is contained in:
committed by
Qt Cherry-pick Bot
parent
7f95accae4
commit
251dcdd54c
@@ -232,7 +232,7 @@ inline void QFreeList<T, ConstantsType>::release(int id)
|
||||
{
|
||||
int at = id & ConstantsType::IndexMask;
|
||||
const int block = blockfor(at);
|
||||
ElementType *v = _v[block].loadRelaxed();
|
||||
ElementType *v = _v[block].loadAcquire();
|
||||
|
||||
int x, newid;
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user