diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-27 21:48:18 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-02 20:52:08 +0100 |
commit | 189ddd88f94809942d92c2aa37b83cf65be8be4a (patch) | |
tree | 14f53033f66922bc4385f1307f2d412bd8e88b7a /src/qml/qml | |
parent | 52dc3f6937d51046424b232323189dfb41cc09c7 (diff) |
[new compiler] Fix QQmlPropertyMap tests
QQmlPropertyMap is treated as a type that cannot be cached with QQmlPropertyCache,
doesn't allow for accelerated property access and also doesn't allow for declarations
of any kind in sub-types.
Change-Id: Id8a6811120aa61ffb5037394e758cc62501e0fc3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlcompileddata.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 12 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator_p.h | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlcompileddata.cpp b/src/qml/qml/qqmlcompileddata.cpp index 75740e17e6..aec4553d5d 100644 --- a/src/qml/qml/qqmlcompileddata.cpp +++ b/src/qml/qml/qqmlcompileddata.cpp @@ -193,7 +193,7 @@ void QQmlCompiledData::TypeReference::doDynamicTypeCheck() mo = typePropertyCache->firstCppMetaObject(); else if (type) mo = type->metaObject(); - else + else if (component) mo = component->rootPropertyCache->firstCppMetaObject(); isFullyDynamicType = qtTypeInherits<QQmlPropertyMap>(mo); } diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 68d128d79a..5f0b5f79be 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -952,6 +952,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent) QObject *instance = 0; QQmlCustomParser *customParser = 0; QQmlParserStatus *parserStatus = 0; + bool installPropertyCache = true; if (compiledData->isComponent(index)) { isComponent = true; @@ -963,6 +964,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent) QQmlCompiledData::TypeReference *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); Q_ASSERT(typeRef); + installPropertyCache = !typeRef->isFullyDynamicType; QQmlType *type = typeRef->type; if (type) { instance = type->create(); @@ -1054,7 +1056,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent) qSwap(_qmlContext, qmlContext); - bool result = populateInstance(index, instance, cache, /*binding target*/instance, /*value type property*/0); + bool result = populateInstance(index, instance, cache, /*binding target*/instance, /*value type property*/0, installPropertyCache); qSwap(_qmlContext, qmlContext); qSwap(_scopeObject, scopeObject); @@ -1134,7 +1136,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru return sharedState->rootContext; } -bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QQmlRefPointer<QQmlPropertyCache> cache, QObject *bindingTarget, QQmlPropertyData *valueTypeProperty) +bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QQmlRefPointer<QQmlPropertyCache> cache, QObject *bindingTarget, QQmlPropertyData *valueTypeProperty, bool installPropertyCache) { const QV4::CompiledData::Object *obj = qmlUnit->objectAt(index); @@ -1162,8 +1164,10 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QQmlRefPo } else { vmeMetaObject = QQmlVMEMetaObject::get(_qobject); } - _ddata->propertyCache = _propertyCache; - _ddata->propertyCache->addref(); + if (installPropertyCache) { + _ddata->propertyCache = _propertyCache; + _ddata->propertyCache->addref(); + } _ddata->lineNumber = _compiledObject->location.line; _ddata->columnNumber = _compiledObject->location.column; diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index 31fbbbd380..2545e45fb6 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -80,7 +80,7 @@ private: QObject *createInstance(int index, QObject *parent = 0); - bool populateInstance(int index, QObject *instance, QQmlRefPointer<QQmlPropertyCache> cache, QObject *bindingTarget, QQmlPropertyData *valueTypeProperty); + bool populateInstance(int index, QObject *instance, QQmlRefPointer<QQmlPropertyCache> cache, QObject *bindingTarget, QQmlPropertyData *valueTypeProperty, bool installPropertyCache = true); void setupBindings(); bool setPropertyBinding(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding); |