QGestureManager: fix UB (invalid pointer comparison)

Comparing pointers with op< that do not point into the same array is
UB. Fix, in the usual way, by using std::less.

Change-Id: Id2c957557719887b2016632d683dbab8af07b34c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2017-12-17 11:42:41 +01:00
parent 0857db89bf
commit b0938cb6c1

View File

@ -59,6 +59,8 @@
#ifndef QT_NO_GESTURES
#include <functional>
QT_BEGIN_NAMESPACE
class QBasicTimer;
@ -112,7 +114,7 @@ private:
ObjectGesture(QObject *o, const Qt::GestureType &g) : object(o), gesture(g) { }
inline bool operator<(const ObjectGesture &rhs) const
{
if (object < rhs.object)
if (std::less<QObject *>{}(object, rhs.object))
return true;
if (object == rhs.object)
return gesture < rhs.gesture;