Better make InternalClass::addMember() safe
authorLars Knoll <lars.knoll@digia.com>
Sun, 5 May 2013 20:08:52 +0000 (22:08 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Sun, 5 May 2013 20:17:01 +0000 (22:17 +0200)
The method should not get called repeatedly with the same member,
but currently this still happens (esp. as we have the v4 engine in TLS),
so let's make the call safe.

Change-Id: Icc3bce48af67f77c7b64040685b1c861c23f5b8d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/qml/v4/qv4internalclass.cpp

index f078c51..19b25cd 100644 (file)
@@ -92,7 +92,8 @@ InternalClass *InternalClass::addMember(String *string, PropertyAttributes data,
     engine->identifierCache->toIdentifier(string);
     uint id = string->identifier | (data.flags() << 27);
 
-    assert(propertyTable.constFind(id) == propertyTable.constEnd());
+    if (propertyTable.constFind(string->identifier) != propertyTable.constEnd())
+        return changeMember(string, data, index);
 
     QHash<int, InternalClass *>::const_iterator tit = transitions.constFind(id);