aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-09-08 09:43:21 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-09-08 12:46:37 +0000
commit874539649508cc1a9cd0ec7ab45b374d18c2c4e5 (patch)
treef583de7b2e94b00f3042d5ccb191be7ab8c12bb9
parent286d72e458c10bae3ce11c58a16352a53ba06aef (diff)
Fix crash with loading cache files originating from top-level components
If a .qml file starts with Component {} and its item(s) define their own properties, alias, etc. then loading this file initially would work, but loading it from a cache file would crash with dangling pointers in the property cache. This was due to us registering aliases, properties, etc. twice in the property cache, exceeding the reservation in the property cache vectors. The minimal fix is to skip the root object in the property cache creating loop as we do handle it separately afterwards. It needs to be separate because the first object index within the component does not stem from a binding. However as the root object index is always zero, I'll make a follow-up patch to get rid of of the variable. Task-number: QTBUG-62263 Change-Id: I86b76d38cb490750a561eac2b0ad6fff6ef2e20a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/qml/compiler/qqmlpropertycachecreator_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h
index 8fc8943366..2dd2e82651 100644
--- a/src/qml/compiler/qqmlpropertycachecreator_p.h
+++ b/src/qml/compiler/qqmlpropertycachecreator_p.h
@@ -562,6 +562,8 @@ template <typename ObjectContainer>
inline void QQmlPropertyCacheAliasCreator<ObjectContainer>::appendAliasPropertiesToMetaObjects()
{
for (int i = 0; i < objectContainer->objectCount(); ++i) {
+ if (i == objectContainer->rootObjectIndex())
+ continue;
const CompiledObject &component = *objectContainer->objectAt(i);
if (!(component.flags & QV4::CompiledData::Object::IsComponent))
continue;