aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsapi')
-rw-r--r--src/qml/jsapi/qjsvalue.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index ca2f398f2f..908e9a4519 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -663,12 +663,17 @@ QJSEngine* QJSValue::engine() const
*/
QJSValue QJSValue::prototype() const
{
- Object *o = d->value.asObject();
+ QV4::ExecutionEngine *engine = d->engine;
+ if (!engine)
+ return QJSValue();
+ QV4::Scope scope(engine);
+ Scoped<Object> o(scope, d->value.asObject());
if (!o)
return QJSValue();
- if (!o->prototype())
+ Scoped<Object> p(scope, o->prototype());
+ if (!p)
return QJSValue(NullValue);
- return new QJSValuePrivate(o->internalClass->engine, Value::fromObject(o->prototype()));
+ return new QJSValuePrivate(o->internalClass->engine, p.asValue());
}
/*!