diff options
-rw-r--r-- | src/qml/qml/qqmlmetatypedata.cpp | 7 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycache_p.h | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlmetatypedata.cpp b/src/qml/qml/qqmlmetatypedata.cpp index c5b9ae1a15..989f1adf7c 100644 --- a/src/qml/qml/qqmlmetatypedata.cpp +++ b/src/qml/qml/qqmlmetatypedata.cpp @@ -129,12 +129,15 @@ QQmlPropertyCache *QQmlMetaTypeData::propertyCache(const QQmlType &type, int min int rev = currentType.metaObjectRevision(); int moIndex = types.count() - 1 - ii; - if (raw->allowedRevisionCache[moIndex] != rev) { + if (raw->allowedRevision(moIndex) != rev) { if (!hasCopied) { + // TODO: The copy should be mutable, and the original should be const + // Considering this, the setAllowedRevision() below does not violate + // the immutability of already published property caches. raw = raw->copy(); hasCopied = true; } - raw->allowedRevisionCache[moIndex] = rev; + raw->setAllowedRevision(moIndex, rev); } } diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index 7369714f70..68f086e191 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -172,6 +172,10 @@ public: static bool addToHash(QCryptographicHash &hash, const QMetaObject &mo); QByteArray checksum(bool *ok); + + int allowedRevision(int index) const { return allowedRevisionCache[index]; } + void setAllowedRevision(int index, int allowed) { allowedRevisionCache[index] = allowed; } + private: friend class QQmlEnginePrivate; friend class QQmlCompiler; @@ -179,7 +183,6 @@ private: template <typename T> friend class QQmlPropertyCacheAliasCreator; friend class QQmlComponentAndAliasResolver; friend class QQmlMetaObject; - friend struct QQmlMetaTypeData; inline QQmlPropertyCache *copy(int reserve); |