Fix property lookup in QDeclarativePropertyCache::create.
authorRoberto Raggi <roberto.raggi@nokia.com>
Thu, 18 Aug 2011 14:36:10 +0000 (16:36 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 30 Aug 2011 11:18:28 +0000 (13:18 +0200)
Search for the property in the current meta object.

Change-Id: I085f4285298ae952d9c50ee93c47b4009dbe900f
Reviewed-on: http://codereview.qt.nokia.com/3792
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>

src/declarative/qml/qdeclarativepropertycache.cpp

index 6ccb5c6..406e43f 100644 (file)
@@ -241,12 +241,13 @@ QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObj
     QDeclarativePropertyCache::Data rv;
     {
         const QMetaObject *cmo = metaObject;
+        const QByteArray propertyName = property.toUtf8();
         while (cmo) {
-            int idx = metaObject->indexOfProperty(property.toUtf8());
+            int idx = cmo->indexOfProperty(propertyName);
             if (idx != -1) {
-                QMetaProperty p = metaObject->property(idx);
+                QMetaProperty p = cmo->property(idx);
                 if (p.isScriptable()) {
-                    rv.load(metaObject->property(idx));
+                    rv.load(p);
                     return rv;
                 } else {
                     while (cmo && cmo->propertyOffset() >= idx)