diff options
author | Simon Hausmann <[email protected]> | 2017-09-08 09:43:21 +0200 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2017-09-08 12:46:37 +0000 |
commit | 874539649508cc1a9cd0ec7ab45b374d18c2c4e5 (patch) | |
tree | f583de7b2e94b00f3042d5ccb191be7ab8c12bb9 /src/qml/compiler/qqmlpropertycachecreator_p.h | |
parent | 286d72e458c10bae3ce11c58a16352a53ba06aef (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 <[email protected]>
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/compiler/qqmlpropertycachecreator_p.h')
-rw-r--r-- | src/qml/compiler/qqmlpropertycachecreator_p.h | 2 |
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; |