aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-03-11 13:12:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-11 18:31:21 +0100
commitaf7ba8a6194b83fe7380b8d4ae027e2f04e21f17 (patch)
tree2d8eb6e7af9c34405659dc87c9aa6a150ceaa9cb /src/qml/qml/qqmlobjectcreator.cpp
parent95444c589763e16fb1c2cf1e1bc892fa5cc41a3a (diff)
Fix incorrectly initialized property cache on group objects
When initializing bindings on group objects, we would accidentally set the property cache for the property type instead of preserving a possibly earlier initialized cache on the ddata of the QObject. Task-number: QTBUG-37390 Change-Id: I4d6a4ce6b3382f378f9a9ddfe11924860a15979d Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index ac438b2b7c..150401a358 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -796,12 +796,6 @@ bool QQmlObjectCreator::setPropertyBinding(QQmlPropertyData *property, const QV4
groupObject = valueType;
valueTypeProperty = property;
} else {
- groupObjectPropertyCache = enginePrivate->propertyCacheForType(property->propType);
- if (!groupObjectPropertyCache) {
- recordError(binding->location, tr("Invalid grouped property access"));
- return false;
- }
-
void *argv[1] = { &groupObject };
QMetaObject::metacall(_qobject, QMetaObject::ReadProperty, property->coreIndex, argv);
if (!groupObject) {
@@ -809,6 +803,16 @@ bool QQmlObjectCreator::setPropertyBinding(QQmlPropertyData *property, const QV4
return false;
}
+ if (QQmlData *groupDeclarativeData = QQmlData::get(groupObject))
+ groupObjectPropertyCache = groupDeclarativeData->propertyCache;
+ if (!groupObjectPropertyCache)
+ groupObjectPropertyCache = enginePrivate->propertyCacheForType(property->propType);
+ if (!groupObjectPropertyCache) {
+ recordError(binding->location, tr("Invalid grouped property access"));
+ return false;
+ }
+
+
bindingTarget = groupObject;
}
@@ -1284,6 +1288,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QQmlRefPo
vmeMetaObject = new QQmlVMEMetaObject(_qobject, _propertyCache, reinterpret_cast<const QQmlVMEMetaData*>(data.constData()));
if (_ddata->propertyCache)
_ddata->propertyCache->release();
+ Q_ASSERT(installPropertyCache);
scopeObjectProtector = _ddata->jsWrapper.value();
} else {
vmeMetaObject = QQmlVMEMetaObject::get(_qobject);