aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine_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/qml/qqmlengine_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/qml/qqmlengine_p.h')
-rw-r--r--src/qml/qml/qqmlengine_p.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index 1bdeacd524..3ed8dbccff 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -208,7 +208,7 @@ public:
QString offlineStorageDatabaseDirectory() const;
// These methods may be called from the loader thread
- inline QQmlPropertyCache *cache(QQmlType *, int);
+ inline QQmlPropertyCache *cache(const QQmlType &, int);
using QJSEnginePrivate::cache;
// These methods may be called from the loader thread
@@ -260,11 +260,11 @@ public:
private:
// Must be called locked
- QQmlPropertyCache *createCache(QQmlType *, int);
+ QQmlPropertyCache *createCache(const QQmlType &, int);
// These members must be protected by a QQmlEnginePrivate::Locker as they are required by
// the threaded loader. Only access them through their respective accessor methods.
- QHash<QPair<QQmlType *, int>, QQmlPropertyCache *> typePropertyCache;
+ QHash<QPair<QQmlType, int>, QQmlPropertyCache *> typePropertyCache;
QHash<int, int> m_qmlLists;
QHash<int, QV4::CompiledData::CompilationUnit *> m_compositeTypes;
static bool s_designerMode;
@@ -375,12 +375,12 @@ Returns a QQmlPropertyCache for \a type with \a minorVersion.
The returned cache is not referenced, so if it is to be stored, call addref().
*/
-QQmlPropertyCache *QQmlEnginePrivate::cache(QQmlType *type, int minorVersion)
+QQmlPropertyCache *QQmlEnginePrivate::cache(const QQmlType &type, int minorVersion)
{
- Q_ASSERT(type);
+ Q_ASSERT(type.isValid());
- if (minorVersion == -1 || !type->containsRevisionedAttributes())
- return cache(type->metaObject());
+ if (minorVersion == -1 || !type.containsRevisionedAttributes())
+ return cache(type.metaObject());
Locker locker(this);
QQmlPropertyCache *rv = typePropertyCache.value(qMakePair(type, minorVersion));