Properly initialize the memberdata to undefined
authorLars Knoll <lars.knoll@theqtcompany.com>
Mon, 10 Aug 2015 09:54:51 +0000 (11:54 +0200)
committerSimon Hausmann <simon.hausmann@theqtcompany.com>
Tue, 18 Aug 2015 20:27:05 +0000 (20:27 +0000)
This avoids running into assertions in other places.

Change-Id: Ia7f9dbdccdd6d3a338845754801e881d44efebb7
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
src/qml/qml/qqmlvmemetaobject.cpp

index 56d566687b2fe4767ca08a97123b38c9ddb63c25..08c5ed4f9e2af80deb2a6795cb7a9021bd97a132 100644 (file)
@@ -1119,7 +1119,10 @@ void QQmlVMEMetaObject::allocateProperties()
     QQmlEngine *qml = qmlEngine(object);
     Q_ASSERT(qml);
     QV4::ExecutionEngine *v4 = QV8Engine::getV4(qml->handle());
-    properties.set(v4, QV4::MemberData::reallocate(v4, 0, metaData->propertyCount));
+    QV4::Heap::MemberData *data = QV4::MemberData::reallocate(v4, 0, metaData->propertyCount);
+    properties.set(v4, data);
+    for (uint i = 0; i < data->size; ++i)
+        data->data[i] = QV4::Encode::undefined();
     propertiesInitialized = true;
 }