aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlpropertycachecreator_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-06-23 13:20:23 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-08-02 16:32:43 +0000
commit49a11e882059ee1729f776722e085dd21d378c36 (patch)
tree1b0fe9a471766d97d03602502acc57c00df93b36 /src/qml/compiler/qqmlpropertycachecreator_p.h
parent97165444ac6954766d53c3eb62eb1614644c7264 (diff)
Use QQmlType by value
QQmlType is now refcounted, and we need to use it by value, to control it's lifetime properly. This is required, so we can clean up the QQmlMetaTypeData cache on engine destruction and with trimComponentCache() Task-number: QTBUG-61536 Change-Id: If86391c86ea20a646ded7c9925d8f743f628fb91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlpropertycachecreator_p.h')
-rw-r--r--src/qml/compiler/qqmlpropertycachecreator_p.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h
index 3c14abc019..8fc8943366 100644
--- a/src/qml/compiler/qqmlpropertycachecreator_p.h
+++ b/src/qml/compiler/qqmlpropertycachecreator_p.h
@@ -211,12 +211,12 @@ inline QQmlPropertyCache *QQmlPropertyCacheCreator<ObjectContainer>::propertyCac
} else if (context.instantiatingBinding && context.instantiatingBinding->isAttachedProperty()) {
auto *typeRef = objectContainer->resolvedTypes.value(context.instantiatingBinding->propertyNameIndex);
Q_ASSERT(typeRef);
- QQmlType *qmltype = typeRef->type;
- if (!qmltype) {
+ QQmlType qmltype = typeRef->type;
+ if (!qmltype.isValid()) {
QString propertyName = stringAt(context.instantiatingBinding->propertyNameIndex);
if (imports->resolveType(propertyName, &qmltype, 0, 0, 0)) {
- if (qmltype->isComposite()) {
- QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype->sourceUrl());
+ if (qmltype.isComposite()) {
+ QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype.sourceUrl());
Q_ASSERT(tdata);
Q_ASSERT(tdata->isComplete());
@@ -228,7 +228,7 @@ inline QQmlPropertyCache *QQmlPropertyCacheCreator<ObjectContainer>::propertyCac
}
}
- const QMetaObject *attachedMo = qmltype ? qmltype->attachedPropertiesType(enginePrivate) : 0;
+ const QMetaObject *attachedMo = qmltype.attachedPropertiesType(enginePrivate);
if (!attachedMo) {
*error = QQmlCompileError(context.instantiatingBinding->location, QQmlPropertyCacheCreatorBase::tr("Non-existent attached object"));
return nullptr;
@@ -395,12 +395,12 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj
// lazily resolved type
Q_ASSERT(param->type == QV4::CompiledData::Property::Custom);
const QString customTypeName = stringAt(param->customTypeNameIndex);
- QQmlType *qmltype = 0;
+ QQmlType qmltype;
if (!imports->resolveType(customTypeName, &qmltype, 0, 0, 0))
return QQmlCompileError(s->location, QQmlPropertyCacheCreatorBase::tr("Invalid signal parameter type: %1").arg(customTypeName));
- if (qmltype->isComposite()) {
- QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype->sourceUrl());
+ if (qmltype.isComposite()) {
+ QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype.sourceUrl());
Q_ASSERT(tdata);
Q_ASSERT(tdata->isComplete());
@@ -410,7 +410,7 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj
tdata->release();
} else {
- paramTypes[i + 1] = qmltype->typeId();
+ paramTypes[i + 1] = qmltype.typeId();
}
}
}
@@ -475,14 +475,14 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj
Q_ASSERT(p->type == QV4::CompiledData::Property::CustomList ||
p->type == QV4::CompiledData::Property::Custom);
- QQmlType *qmltype = 0;
+ QQmlType qmltype;
if (!imports->resolveType(stringAt(p->customTypeNameIndex), &qmltype, 0, 0, 0)) {
return QQmlCompileError(p->location, QQmlPropertyCacheCreatorBase::tr("Invalid property type"));
}
- Q_ASSERT(qmltype);
- if (qmltype->isComposite()) {
- QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype->sourceUrl());
+ Q_ASSERT(qmltype.isValid());
+ if (qmltype.isComposite()) {
+ QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype.sourceUrl());
Q_ASSERT(tdata);
Q_ASSERT(tdata->isComplete());
@@ -497,9 +497,9 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj
tdata->release();
} else {
if (p->type == QV4::CompiledData::Property::Custom) {
- propertyType = qmltype->typeId();
+ propertyType = qmltype.typeId();
} else {
- propertyType = qmltype->qListTypeId();
+ propertyType = qmltype.qListTypeId();
}
}
@@ -675,8 +675,8 @@ inline void QQmlPropertyCacheAliasCreator<ObjectContainer>::propertyDataForAlias
auto *typeRef = objectContainer->resolvedTypes.value(targetObject.inheritedTypeNameIndex);
Q_ASSERT(typeRef);
- if (typeRef->type)
- *type = typeRef->type->typeId();
+ if (typeRef->type.isValid())
+ *type = typeRef->type.typeId();
else
*type = typeRef->compilationUnit->metaTypeId;