Fix GC errors in small objects during construction
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 21 Jun 2013 19:28:11 +0000 (21:28 +0200)
committerLars Knoll <lars.knoll@digia.com>
Fri, 21 Jun 2013 19:47:17 +0000 (21:47 +0200)
When creating small objects with for example only one accessor property,
then that is stored in the inline member allocation, which needs to
be initialized as well to prevent GCs during construction to access
uninitialized members.

Change-Id: Ie20d27a650e09475845f8ee6aa79b8e62a4bb795
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v4/qv4object.cpp

index 637f229..5bb556b 100644 (file)
@@ -77,6 +77,7 @@ Object::Object(ExecutionEngine *engine)
 {
     vtbl = &static_vtbl;
     type = Type_Object;
+    memset(memberData, 0, sizeof(Property)*memberDataAlloc);
 }
 
 Object::Object(ExecutionContext *context)
@@ -88,6 +89,7 @@ Object::Object(ExecutionContext *context)
 {
     vtbl = &static_vtbl;
     type = Type_Object;
+    memset(memberData, 0, sizeof(Property)*memberDataAlloc);
 }
 
 Object::Object(ExecutionEngine *engine, InternalClass *internalClass)
@@ -104,6 +106,7 @@ Object::Object(ExecutionEngine *engine, InternalClass *internalClass)
         memberDataAlloc = internalClass->size;
         memberData = new Property[memberDataAlloc];
     }
+    memset(memberData, 0, sizeof(Property)*memberDataAlloc);
 }
 
 Object::~Object()