aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycachecreator.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-02-11 11:47:58 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-02-12 15:39:11 +0100
commit7d0c2db2c70ae6c58350f888b67aefffae6a443e (patch)
tree1258128629d2f35a79e71e94e9d23f0932fcd5ac /src/qml/qml/qqmlpropertycachecreator.cpp
parent074aa948000088e816f11eb5cc46abc8be40df96 (diff)
Always search for instantiating property cache by QQmlType
When given an invalid type revision rawPropertyCacheForType() assumes we want to search by metaObject. However, in the case of instantiatingPropertyCache we always want to search by QQmlType, and we want the invalid type revision to be interpreted as "any version". Change-Id: I79d0a137e4b2e7e2d6063c47afae55d3302e67d6 Fixes: QTBUG-81967 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycachecreator.cpp')
-rw-r--r--src/qml/qml/qqmlpropertycachecreator.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlpropertycachecreator.cpp b/src/qml/qml/qqmlpropertycachecreator.cpp
index c85c44eab7..5e83deff18 100644
--- a/src/qml/qml/qqmlpropertycachecreator.cpp
+++ b/src/qml/qml/qqmlpropertycachecreator.cpp
@@ -119,9 +119,13 @@ QQmlRefPointer<QQmlPropertyCache> QQmlBindingInstantiationContext::instantiating
{
if (instantiatingProperty) {
if (instantiatingProperty->isQObject()) {
+ // If the typeVersion is invalid here, we want to match any version we can find.
+ // 254.254 is the largest version QTypeRevision can hold.
return enginePrivate->rawPropertyCacheForType(
instantiatingProperty->propType(),
- instantiatingProperty->typeVersion());
+ instantiatingProperty->typeVersion().isValid()
+ ? instantiatingProperty->typeVersion()
+ : QTypeRevision::fromVersion(254, 254));
} else if (const QMetaObject *vtmo = QQmlValueTypeFactory::metaObjectForMetaType(instantiatingProperty->propType())) {
return enginePrivate->cache(vtmo, instantiatingProperty->typeVersion());
}