diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-06-26 13:45:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-08-02 16:32:56 +0000 |
commit | e61dca72682c9f65c6ab6254fc7e80b49be3ad43 (patch) | |
tree | e11413ad237abc8df737c4e55bc38a8012c2ae14 /src/qml/qml/qqmlmetatype_p.h | |
parent | aa6120cc3524b8d603e92e952aece7494a5d8f02 (diff) |
Change data structures in QQmlMetaTypeData
Make sure any QQmlType stored in the meta type data
has a refcount of 1. This should now make it possible
to clean out unused types by iterating over the
list of types and removing those that have a refcount
of 1.
Some care is still needed for C++ registered types, that
will need to get one more refcount, so we don't accidentally
remove them.
Task-number: QTBUG-61536
Change-Id: Id2a18dae5ddcb815f34013f5fde1f05d2d9d0214
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype_p.h')
-rw-r--r-- | src/qml/qml/qqmlmetatype_p.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index 43eda2b4f1..0077306a64 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -78,9 +78,9 @@ class Q_QML_PRIVATE_EXPORT QQmlMetaType { public: static QList<QString> qmlTypeNames(); - static QList<QQmlType *> qmlTypes(); + static QList<QQmlType> qmlTypes(); static QList<QQmlType> qmlSingletonTypes(); - static QList<QQmlType *> qmlAllTypes(); + static QList<QQmlType> qmlAllTypes(); static QQmlType qmlType(const QString &qualifiedName, int, int); static QQmlType qmlType(const QHashedStringRef &name, const QHashedStringRef &module, int, int); @@ -148,10 +148,6 @@ public: explicit QQmlType(QQmlTypePrivate *priv); ~QQmlType(); - // ### get rid of these two again - QQmlType(QQmlType *otherPointer); - QQmlType &operator =(QQmlType *otherPointer); - bool operator ==(const QQmlType &other) const { return d == other.d; } @@ -238,7 +234,7 @@ public: int enumValue(QQmlEnginePrivate *engine, const QHashedCStringRef &, bool *ok) const; int enumValue(QQmlEnginePrivate *engine, const QV4::String *, bool *ok) const; - QQmlTypePrivate *handle() const { return d; } + QQmlTypePrivate *priv() const { return d; } static void refHandle(QQmlTypePrivate *priv); static void derefHandle(QQmlTypePrivate *priv); private: @@ -246,7 +242,6 @@ private: QQmlType resolveCompositeBaseType(QQmlEnginePrivate *engine) const; int resolveCompositeEnumValue(QQmlEnginePrivate *engine, const QString &name, bool *ok) const; friend class QQmlTypePrivate; - friend struct QQmlMetaTypeData; enum RegistrationType { CppType = 0, @@ -296,7 +291,7 @@ public: private: //Used by register functions and creates the QQmlTypeModule for them friend QQmlTypeModule *getTypeModule(const QHashedString &uri, int majorVersion, QQmlMetaTypeData *data); - friend void addTypeToData(QQmlType* type, QQmlMetaTypeData *data); + friend void addTypeToData(QQmlTypePrivate *type, QQmlMetaTypeData *data); friend struct QQmlMetaTypeData; friend Q_QML_EXPORT void qmlClearTypeRegistrations(); friend class QQmlTypeModulePrivate; |