aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvmemetaobject_p.h
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2012-09-27 16:56:03 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-28 13:26:16 +0200
commit5bd0e08063fcacba0c2b63528712968c7d74e7f9 (patch)
treec430c6b783922fd310ec510fef08fc075c891f7f /src/qml/qml/qqmlvmemetaobject_p.h
parentb68fb568d8287e9a0c45a0dc0187398995313969 (diff)
Fix a crash in QQmlPropertyCache::findProperty
When the top type of a QML component is a C++ type registered with qmlRegisterExtendedType, its QObjectPrivate::metaObject is already a QQmlProxyMetaObject that gets chained as the parent of the QQmlVMEMetaObject of the component. When QQmlPropertyCache::findProperty iterates over the parents chain of a child item, our QQmlProxyMetaObject eventually gets static_casted to QQmlVMEMetaObject and causes a crash. This patch implements a poor man's dynamic_cast in QQmlVMEMetaObject::parentVMEMetaObject to fix the crash. Other casts of parent.asT1() are changed to use parentVMEMetaObject as well even though in those cases the static_cast is guaranteed by the context. Task-number: QTBUG-27334 Change-Id: I5982fc273ccf466960ce54974cff5662e6ab605a Reviewed-by: Matthew Vogt <mattvogt2@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvmemetaobject_p.h')
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index 8329e3ce16..c858370d27 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -287,7 +287,7 @@ int QQmlVMEMetaObject::signalCount() const
QQmlVMEMetaObject *QQmlVMEMetaObject::parentVMEMetaObject() const
{
- if (parent.isT1())
+ if (parent.isT1() && parent.flag())
return static_cast<QQmlVMEMetaObject *>(parent.asT1());
return 0;