aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4internalclass_p.h
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@crimson.no>2017-01-19 09:05:46 +0100
committerGunnar Sletta <gunnar@crimson.no>2017-01-19 12:51:28 +0000
commit94324a4ea2261940d1d55dec141c885bf4f57832 (patch)
treeba2a474e856f48bb4f33f76cbb0ec3c97267eaff /src/qml/jsruntime/qv4internalclass_p.h
parent89c6bee139422b17534f79129eea2820d2ce952e (diff)
Fix memory leak in V4
Transitions contain both an id and a set of flags, but the sorting failed to take the flags into account in the operator<. As a result we would some times end up with duplicate entries if the same id was added multiple times with different flags. If the same id was added again and again with varying flags, this could lead to an ever expanding list filled with duplicate entries. Fix this by also taking flags into account in operator< so that operator< and operator== are symetric and the list gets correctly sorted. Change-Id: I762ec3f0c5b4ed9a1aecb9a883187a0445491591 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'src/qml/jsruntime/qv4internalclass_p.h')
-rw-r--r--src/qml/jsruntime/qv4internalclass_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h
index dcda949c97..1d8ef4b0fb 100644
--- a/src/qml/jsruntime/qv4internalclass_p.h
+++ b/src/qml/jsruntime/qv4internalclass_p.h
@@ -234,7 +234,7 @@ struct InternalClassTransition
{ return id == other.id && flags == other.flags; }
bool operator<(const InternalClassTransition &other) const
- { return id < other.id; }
+ { return id < other.id || (id == other.id && flags < other.flags); }
};
struct InternalClass : public QQmlJS::Managed {