From 28bd5d733ba1b0eedd3fff24ad42ab0e5e87a2e6 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 29 Mar 2010 15:26:30 +1000 Subject: Optimization: reduce allocations --- src/declarative/qml/qdeclarativevmemetaobject.cpp | 6 +++--- src/declarative/qml/qdeclarativevmemetaobject_p.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index 721e1f1..9a7bdd6 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -396,6 +396,7 @@ QDeclarativeVMEMetaObject::QDeclarativeVMEMetaObject(QObject *obj, methodOffset = QAbstractDynamicMetaObject::methodOffset(); data = new QDeclarativeVMEVariant[metaData->propertyCount]; + aConnected.resize(metaData->aliasCount); int list_type = qMetaTypeId >(); @@ -403,7 +404,7 @@ QDeclarativeVMEMetaObject::QDeclarativeVMEMetaObject(QObject *obj, for (int ii = 0; ii < metaData->propertyCount; ++ii) { int t = (metaData->propertyData() + ii)->propertyType; if (t == list_type) { - listProperties.append(new List(methodOffset + ii)); + listProperties.append(List(methodOffset + ii)); data[ii].setValue(listProperties.count() - 1); } } @@ -413,7 +414,6 @@ QDeclarativeVMEMetaObject::~QDeclarativeVMEMetaObject() { compiledData->release(); delete parent; - qDeleteAll(listProperties); delete [] data; delete [] methods; } @@ -505,7 +505,7 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) } if (t == qMetaTypeId >()) { int listIndex = data[id].asInt(); - const List *list = listProperties.at(listIndex); + const List *list = &listProperties.at(listIndex); *reinterpret_cast *>(a[0]) = QDeclarativeListProperty(object, (void *)list, list_append, list_count, list_at, diff --git a/src/declarative/qml/qdeclarativevmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h index 4718fa7..839f0cd 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject_p.h +++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h @@ -158,7 +158,7 @@ private: List(int lpi) : notifyIndex(lpi) {} int notifyIndex; }; - QList listProperties; + QList listProperties; static void list_append(QDeclarativeListProperty *, QObject *); static int list_count(QDeclarativeListProperty *); -- cgit v0.12