diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-11 14:36:01 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:13:21 +0200 |
commit | 002e6105f61269f1474de878ccdb26205e5b226e (patch) | |
tree | ead1d10b7d8aa2537e7073327d9d0d9ce591c995 /src/qml/jsruntime/qv4runtime.cpp | |
parent | 1a2a83f80ba4ecc28eba72af57c81bd43a45946c (diff) |
Require a ValueScope for ScopedCallData as well
This brings things more in line with ScopedValue, and
also simplifies cleanup of Scoped values.
Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index a6fc9f8967..ad2ac19ea6 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -570,20 +570,19 @@ ReturnedValue __qmljs_object_default_value(Object *object, int typeHint) qSwap(meth1, meth2); ExecutionContext *ctx = engine->current; + ValueScope scope(ctx); + ScopedCallData callData(scope, 0); + callData->thisObject = Value::fromObject(object); - Value conv = object->get(meth1); - if (FunctionObject *o = conv.asFunctionObject()) { - ScopedCallData callData(engine, 0); - callData->thisObject = Value::fromObject(object); + ScopedValue conv(scope, object->get(meth1)); + if (FunctionObject *o = conv->asFunctionObject()) { Value r = Value::fromReturnedValue(o->call(callData)); if (r.isPrimitive()) return r.asReturnedValue(); } conv = object->get(meth2); - if (FunctionObject *o = conv.asFunctionObject()) { - ScopedCallData callData(engine, 0); - callData->thisObject = Value::fromObject(object); + if (FunctionObject *o = conv->asFunctionObject()) { Value r = Value::fromReturnedValue(o->call(callData)); if (r.isPrimitive()) return r.asReturnedValue(); @@ -698,6 +697,7 @@ ReturnedValue __qmljs_get_element(ExecutionContext *ctx, const ValueRef object, void __qmljs_set_element(ExecutionContext *ctx, const ValueRef object, const ValueRef index, const ValueRef value) { + ValueScope scope(ctx); Object *o = object->toObject(ctx); uint idx = index->asArrayIndex(); @@ -724,7 +724,7 @@ void __qmljs_set_element(ExecutionContext *ctx, const ValueRef object, const Val return; } - ScopedCallData callData(ctx->engine, 1); + ScopedCallData callData(scope, 1); callData->thisObject = Value::fromObject(o); callData->args[0] = *value; setter->call(callData); |