aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-09-02 09:19:06 +0200
committerLars Knoll <lars.knoll@qt.io>2017-09-15 10:45:23 +0000
commitce9eb7b2671d25c463aacb140816b75f5a9dfe64 (patch)
tree7820913be313a762292431cd268d03314734f65d /src/qml/jsruntime/qv4runtime.cpp
parent4ca97d7289276816545ab01c9b49bfaaa29d8f5d (diff)
Fix a smaller bug
We shouldn't allocate new ScopedValues after creating a JSCall, as the call could override the scoped values. This wasn't the case here, but it's still cleaner to avoid it. Change-Id: I557a8babe1e118cbd0c1167c1e2813e1fba792a1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index f09d803d0b..4298d64d20 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -430,9 +430,9 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(const Object *object, int typeH
ScopedValue conv(scope, object->get(meth1));
if (FunctionObject *o = conv->as<FunctionObject>()) {
jsCall->function = o;
- ScopedValue r(scope, jsCall.call());
- if (r->isPrimitive())
- return r->asReturnedValue();
+ jsCall->accumulator = jsCall.call();
+ if (jsCall->accumulator.isPrimitive())
+ return jsCall->accumulator.asReturnedValue();
}
if (engine->hasException)
@@ -441,9 +441,9 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(const Object *object, int typeH
conv = object->get(meth2);
if (FunctionObject *o = conv->as<FunctionObject>()) {
jsCall->function = o;
- ScopedValue r(scope, jsCall.call());
- if (r->isPrimitive())
- return r->asReturnedValue();
+ jsCall->accumulator = jsCall.call();
+ if (jsCall->accumulator.isPrimitive())
+ return jsCall->accumulator.asReturnedValue();
}
return engine->throwTypeError();
@@ -526,7 +526,7 @@ QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionEngine *engine, const Valu
pright = convert_to_string_add(engine, pright);
sright = static_cast<String *>(pright.ptr);
}
- if (scope.engine->hasException)
+ if (engine->hasException)
return Encode::undefined();
if (!sleft->d()->length())
return sright->asReturnedValue();