summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-07-20 01:10:53 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-04-30 17:23:15 +0000
commit0208cac94fbd79fc563c903e2b973d79f9644b82 (patch)
tree8d4c3c572b1eb0e263d3a3acfeb91f155bc0ea56
parentce9dc06b4c120ce6c32eeea71bc2c62dff32b047 (diff)
QItemSelectionRange: don't compare pointers with op<
... use std::less<> to avoid undefined behavior. Change-Id: Ib6736f86359c4a16fd90ca63b57a8517c6137ead Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index 6c7101d41f..74bd7abfcb 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -42,6 +42,7 @@
#include <qdebug.h>
#include <algorithm>
+#include <functional>
#ifndef QT_NO_ITEMVIEWS
@@ -307,7 +308,9 @@ bool QItemSelectionRange::operator<(const QItemSelectionRange &other) const
}
return topLeftParent < otherTopLeftParent;
}
- return tl.model() < other.tl.model();
+
+ std::less<const QAbstractItemModel *> less;
+ return less(tl.model(), other.tl.model());
}
/*!