aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvme.cpp
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-05-15 16:56:40 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-21 00:17:37 +0200
commita96705e349c51215b6e451147b4c2de49ba5a107 (patch)
tree67898969e15f92e95ccfc97a3ce8c4458a8887e7 /src/qml/qml/qqmlvme.cpp
parent5821f91abb348ac8d8ad84846b504c5629d2eed8 (diff)
Allow the existence of a VME metaobject to be asserted
Test for the existence of a VME metaobject. Otherwise, assertion of a static cast result is not meaningful. Change-Id: Ic9e9c38e5dce65c41d20e405c33e179334c37b00 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r--src/qml/qml/qqmlvme.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index ba0f202bcc..08ab49493d 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -298,8 +298,8 @@ static QVariant variantFromString(const QString &string)
v8::Handle<v8::Value> v8value = value; \
QObject *target = objects.top(); \
CLEAN_PROPERTY(target, instr.propertyIndex); \
- QMetaObject *mo = const_cast<QMetaObject *>(target->metaObject()); \
- QQmlVMEMetaObject *vmemo = static_cast<QQmlVMEMetaObject *>(mo); \
+ QQmlVMEMetaObject *vmemo = QQmlVMEMetaObject::get(target); \
+ Q_ASSERT(vmemo); \
vmemo->setVMEProperty(instr.propertyIndex, v8value); \
QML_END_INSTR(name)
@@ -920,7 +920,8 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QQmlPropertyPrivate::restore(target, instr.property, CTXT);
obj->setParent(target);
vi->setTarget(prop);
- QQmlVMEMetaObject *mo = static_cast<QQmlVMEMetaObject *>((QMetaObject*)target->metaObject());
+ QQmlVMEMetaObject *mo = QQmlVMEMetaObject::get(target);
+ Q_ASSERT(mo);
mo->registerInterceptor(prop.index(), QQmlPropertyPrivate::valueTypeCoreIndex(prop), vi);
QML_END_INSTR(StoreValueInterceptor)