aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@crimson.no>2017-01-19 09:05:46 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2017-02-03 07:41:41 +0000
commitcdbda2e7bd84e7e41812b811890f017e0538b5b9 (patch)
tree044a3bc3d2fdf536c441a84a8f38eca1d1777034
parent89f8c55b6f89c26578b7be9f4db35d0b2ef75a67 (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: I6d55c67083e4a09e3eb2952edbec302389421f33 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no> (cherry picked from commit 94324a4ea2261940d1d55dec141c885bf4f57832)
-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 5b91925ede..964dd504ca 100644
--- a/src/qml/jsruntime/qv4internalclass_p.h
+++ b/src/qml/jsruntime/qv4internalclass_p.h
@@ -212,7 +212,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 {