QOrderedMutexLocker: fix UB (pointer comparison with <) in static relock()
Comparing pointers that do not point into the same array using
operator< is UB. You need to use std::less<>.
The QOrderedMutexLocker ctor already used std::less to compare
pointers, but the static relock() function was not fixed.
Amends 5007352164
.
Change-Id: I584d382391dd5a2af75020a4e77f3e42ee5d5708
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
983d9e0c1a
commit
ed5d04fcfc
@ -93,7 +93,7 @@ public:
|
||||
// mtx1 is already locked, mtx2 not... do we need to unlock and relock?
|
||||
if (mtx1 == mtx2)
|
||||
return false;
|
||||
if (mtx1 < mtx2) {
|
||||
if (std::less<QMutex *>()(mtx1, mtx2)) {
|
||||
mtx2->lock();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user