aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2011-08-11 09:28:22 +0200
committerQt by Nokia <qt-info@nokia.com>2011-08-11 10:22:09 +0200
commitc595315fe45a2baf7a18262d76bb9eb1070d20b4 (patch)
tree0b31f1b32ae3dde61482c55466ae8755b26ad81c
parent65b69351834efe423f7c9f1e85964db8af294394 (diff)
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 <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
-rw-r--r--src/declarative/qml/v8/qv8qobjectwrapper.cpp6
1 files 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<v8::Value> 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<v8::Value> 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)