From ed5d04fcfc4e00ce92b04d442e1e69cebb01bc9c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 14 Oct 2016 10:40:56 +0200 Subject: 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 --- src/corelib/thread/qorderedmutexlocker_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/thread/qorderedmutexlocker_p.h') 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()(mtx1, mtx2)) { mtx2->lock(); return true; } -- cgit v1.2.3