From c595315fe45a2baf7a18262d76bb9eb1070d20b4 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 11 Aug 2011 09:28:22 +0200 Subject: 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 --- src/declarative/qml/v8/qv8qobjectwrapper.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp index 54366af382..c7ed0116e1 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) -- cgit v1.2.3