diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-04-12 10:19:47 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-04-25 19:39:49 +0200 |
commit | f7f6e140947582026d08a68421052e6ac7b997e4 (patch) | |
tree | b3c384d05251845b6a0ad3bd448d4633d1bf79b9 /src/qml/qml/qqmlpropertycache_p.h | |
parent | 7854be01eb94d5c72e0a59628e76ed9f0bb0ca7a (diff) |
QQmlPropertyCache: Guarantee 1:1 relationship to meta object
The QQmlPropertyCache ctor that just takes a QMetaObject is really
dangerous. It misbehaves for anything but plain QObject. Remove it.
Also, realize that we never want to update a property cache
"recursively". That is, each property cache maps exactly one metaobject.
We cannot cover multiple metaobjects with the same property cache.
Finally, any property caches constructed dynamically must not be
recorded in the type registry. These caches are not comparable to
anything else. Introduce a special method to create them.
Fixes: QTBUG-102454
Pick-to: 6.2 6.3
Change-Id: I47a1ff0f467e9444ff9f581ffcdf0a8b5730b0b8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycache_p.h')
-rw-r--r-- | src/qml/qml/qqmlpropertycache_p.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index 831da02431..6e4c24a413 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -167,8 +167,10 @@ public: ConstPtr &operator=(Ptr &&ptr) { return operator=(ConstPtr(std::move(ptr))); } }; + static Ptr createStandalone( + const QMetaObject *, QTypeRevision metaObjectRevision = QTypeRevision::zero()); + QQmlPropertyCache() = default; - QQmlPropertyCache(const QMetaObject *, QTypeRevision metaObjectRevision = QTypeRevision::zero()); ~QQmlPropertyCache() override; void update(const QMetaObject *); @@ -289,8 +291,6 @@ private: const QQmlPropertyData *findProperty(StringCache::ConstIterator it, const QQmlVMEMetaObject *, const QQmlRefPointer<QQmlContextData> &) const; - void updateRecur(const QMetaObject *); - template<typename K> QQmlPropertyData *findNamedProperty(const K &key) const { |