From: Kent Hansen Date: Thu, 11 Aug 2011 07:28:22 +0000 (+0200) Subject: Guard QML-specific handling of value type property access X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=c595315fe45a2baf7a18262d76bb9eb1070d20b4;p=konrad%2Fqtdeclarative.git Guard QML-specific handling of value type property access When using QJSEngine, there is no QDeclarativeEngine associated with the QV8Engine, so check if it's there first. This was causing the QJS qobject bindings autotest to crash. Change-Id: If2c1d414d615bfbe93580d06555f5c17b0e41eef Reviewed-on: http://codereview.qt.nokia.com/2845 Reviewed-by: Qt Sanity Bot Reviewed-by: Aaron Kennedy --- diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp index 54366af..c7ed011 100644 --- a/src/declarative/qml/v8/qv8qobjectwrapper.cpp +++ b/src/declarative/qml/v8/qv8qobjectwrapper.cpp @@ -336,7 +336,8 @@ static v8::Handle LoadProperty(QV8Engine *engine, QObject *object, void *args[] = { &handle, 0 }; QMetaObject::metacall(object, QMetaObject::ReadProperty, property.coreIndex, args); return handle.toHandle(); - } else if (QDeclarativeValueTypeFactory::isValueType((uint)property.propType)) { + } else if (QDeclarativeValueTypeFactory::isValueType((uint)property.propType) + && engine->engine()) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine->engine()); QDeclarativeValueType *valueType = ep->valueTypes[property.propType]; if (valueType) @@ -381,7 +382,8 @@ static v8::Handle LoadPropertyDirect(QV8Engine *engine, QObject *obje void *args[] = { &handle, 0 }; object->qt_metacall(QMetaObject::ReadProperty, property.coreIndex, args); return handle.toHandle(); - } else if (QDeclarativeValueTypeFactory::isValueType((uint)property.propType)) { + } else if (QDeclarativeValueTypeFactory::isValueType((uint)property.propType) + && engine->engine()) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine->engine()); QDeclarativeValueType *valueType = ep->valueTypes[property.propType]; if (valueType)