diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-13 12:33:06 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-13 14:32:34 +0100 |
commit | cfe0b08b5439a27b4fdd14c29620e0492543f506 (patch) | |
tree | e45d282b23bec6504dbaba2b784bbaaa44f0b16b /src/qml/qml/qqmlopenmetaobject.cpp | |
parent | b64f8dacae36fca948933cf56498d5e4ad3e2a07 (diff) |
Remove QQmlCleanup
The only place where it was still used is QQmlOpenMetaObjecType. The
only effect of QQmlCleanup is that clear() is eventually called by the
engine. In the case of QQmlOpenMetaObjectType the only effect of that
was that the "engine" member was reset. However, the only place where
that member was used was in setCached(), and in that place it was
irrelevant. There is no reason why setCached() should be prohibited when
there is no engine. We may be worried that the property cache assigned
to the open metaobject might go away somehow if there is no engine, but
the cleanup mechanism clearly demonstrates that checking for the engine
on setCached() does not protect against this.
Fixes: QTBUG-90004
Change-Id: I05445eaeb53a64c70de366090ea2ee4aecf2bad8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlopenmetaobject.cpp')
-rw-r--r-- | src/qml/qml/qqmlopenmetaobject.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/qml/qml/qqmlopenmetaobject.cpp b/src/qml/qml/qqmlopenmetaobject.cpp index 5319700d85..b5264fcdfc 100644 --- a/src/qml/qml/qqmlopenmetaobject.cpp +++ b/src/qml/qml/qqmlopenmetaobject.cpp @@ -41,7 +41,6 @@ #include <private/qqmlpropertycache_p.h> #include <private/qqmldata_p.h> #include <private/qmetaobjectbuilder_p.h> -#include <qqmlengine.h> #include <qdebug.h> QT_BEGIN_NAMESPACE @@ -50,7 +49,7 @@ QT_BEGIN_NAMESPACE class QQmlOpenMetaObjectTypePrivate { public: - QQmlOpenMetaObjectTypePrivate() : mem(nullptr), cache(nullptr), engine(nullptr) {} + QQmlOpenMetaObjectTypePrivate() : mem(nullptr), cache(nullptr) {} void init(const QMetaObject *metaObj); @@ -60,14 +59,12 @@ public: QMetaObjectBuilder mob; QMetaObject *mem; QQmlPropertyCache *cache; - QQmlEngine *engine; QSet<QQmlOpenMetaObject*> referers; }; -QQmlOpenMetaObjectType::QQmlOpenMetaObjectType(const QMetaObject *base, QQmlEngine *engine) - : QQmlCleanup(engine), d(new QQmlOpenMetaObjectTypePrivate) +QQmlOpenMetaObjectType::QQmlOpenMetaObjectType(const QMetaObject *base) + : d(new QQmlOpenMetaObjectTypePrivate) { - d->engine = engine; d->init(base); } @@ -80,11 +77,6 @@ QQmlOpenMetaObjectType::~QQmlOpenMetaObjectType() delete d; } -void QQmlOpenMetaObjectType::clear() -{ - d->engine = nullptr; -} - int QQmlOpenMetaObjectType::propertyOffset() const { return d->propertyOffset; @@ -258,7 +250,7 @@ public: QQmlOpenMetaObject::QQmlOpenMetaObject(QObject *obj, const QMetaObject *base, bool automatic) : d(new QQmlOpenMetaObjectPrivate(this, automatic, obj)) { - d->type.adopt(new QQmlOpenMetaObjectType(base ? base : obj->metaObject(), nullptr)); + d->type.adopt(new QQmlOpenMetaObjectType(base ? base : obj->metaObject())); d->type->d->referers.insert(this); QObjectPrivate *op = QObjectPrivate::get(obj); @@ -428,7 +420,7 @@ bool QQmlOpenMetaObject::hasValue(int id) const void QQmlOpenMetaObject::setCached(bool c) { - if (c == d->cacheProperties || !d->type->d->engine) + if (c == d->cacheProperties) return; d->cacheProperties = c; |