diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-07-20 01:10:53 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-04-30 17:23:15 +0000 |
commit | 0208cac94fbd79fc563c903e2b973d79f9644b82 (patch) | |
tree | 8d4c3c572b1eb0e263d3a3acfeb91f155bc0ea56 /src | |
parent | ce9dc06b4c120ce6c32eeea71bc2c62dff32b047 (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>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/itemmodels/qitemselectionmodel.cpp | 5 |
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()); } /*! |