diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-02-16 03:49:15 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-02-16 04:01:52 (GMT) |
commit | c37fbe0cbe0ccc0e5991df921aa0c7cf811a3baf (patch) | |
tree | a8a20f215f651634ac2cdc554d4cc703fe6f18b5 /src/declarative/qml | |
parent | a17c34cdddf4bcc619fa660ea520400a1329b34e (diff) | |
download | Qt-c37fbe0cbe0ccc0e5991df921aa0c7cf811a3baf.zip Qt-c37fbe0cbe0ccc0e5991df921aa0c7cf811a3baf.tar.gz Qt-c37fbe0cbe0ccc0e5991df921aa0c7cf811a3baf.tar.bz2 |
Fix crash in QmlMetaProperty that could occur when using value-type
properties after the engine was deleted.
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlengine_p.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 7 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 87864b7..5586311 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -316,6 +316,7 @@ public: static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; } static QmlEngine *getEngine(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p->q_func(); } static QmlEnginePrivate *get(QmlEngine *e) { return e->d_func(); } + static QmlEnginePrivate *get(QmlContext *c) { return (c && c->engine()) ? QmlEnginePrivate::get(c->engine()) : 0; } static QmlEnginePrivate *get(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p; } static QmlEngine *get(QmlEnginePrivate *p) { return p->q_func(); } QmlContext *getContext(QScriptContext *); diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index d63261c..70f9ad3 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -276,7 +276,7 @@ const char *QmlMetaProperty::propertyTypeName() const { if (type() & ValueTypeProperty) { - QmlEnginePrivate *ep = d->context?QmlEnginePrivate::get(d->context->engine()):0; + QmlEnginePrivate *ep = QmlEnginePrivate::get(d->context); QmlValueType *valueType = 0; if (ep) valueType = ep->valueTypes[d->core.propType]; else valueType = QmlValueTypeFactory::valueType(d->core.propType); @@ -689,7 +689,7 @@ QVariant QmlMetaPropertyPrivate::readValueProperty() } else if(type & QmlMetaProperty::ValueTypeProperty) { - QmlEnginePrivate *ep = context?QmlEnginePrivate::get(context->engine()):0; + QmlEnginePrivate *ep = QmlEnginePrivate::get(context); QmlValueType *valueType = 0; if (ep) valueType = ep->valueTypes[core.propType]; else valueType = QmlValueTypeFactory::valueType(core.propType); @@ -762,8 +762,7 @@ bool QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value, bool rv = false; uint type = q->type(); if (type & QmlMetaProperty::ValueTypeProperty) { - QmlEnginePrivate *ep = - context?static_cast<QmlEnginePrivate *>(QObjectPrivate::get(context->engine())):0; + QmlEnginePrivate *ep = QmlEnginePrivate::get(context); QmlValueType *writeBack = 0; if (ep) { |