summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-10-14 10:40:56 +0200
committerTim Jenssen <tim.jenssen@qt.io>2016-10-18 13:46:11 +0000
commited5d04fcfc4e00ce92b04d442e1e69cebb01bc9c (patch)
tree661474f90e751bee0252c963d26004db91ca191f /src/corelib/thread
parent983d9e0c1a93a8f4350fa5c7f1ec4809e15e0d6e (diff)
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 50073521649e3818d87920751ab95acd2c2dfd15. Change-Id: I584d382391dd5a2af75020a4e77f3e42ee5d5708 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qorderedmutexlocker_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/thread/qorderedmutexlocker_p.h b/src/corelib/thread/qorderedmutexlocker_p.h
index 54887342e7..6402be92bf 100644
--- a/src/corelib/thread/qorderedmutexlocker_p.h
+++ b/src/corelib/thread/qorderedmutexlocker_p.h
@@ -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;
}