aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmljavascriptexpression.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-10-23 15:25:47 +0200
committerLars Knoll <lars.knoll@qt.io>2017-11-07 07:24:17 +0000
commitc8547312d3faf1bd357fe03f4717585e23da7680 (patch)
tree567457d9556b72ca11eac4760c2b5da2907f3fd9 /src/qml/qml/qqmljavascriptexpression.cpp
parentb6329aaf18277a25957a8efe8b496960b404bb36 (diff)
Don't add to the JS stack after creating the calldata
Change-Id: Ibc8dc71ffa3b4efb9bc8d6705fb8ac9ee1b4e4d6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/qml/qqmljavascriptexpression.cpp')
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 61879e8b2d..01ac808b9f 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -218,19 +218,18 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QV4::CallData *callData, b
capture.guards.copyAndClearPrepend(activeGuards);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine());
- QV4::Scope scope(v4);
- QV4::ScopedValue value(scope);
- QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue());
callData->thisObject = v4->globalObject;
if (scopeObject()) {
- value = QV4::QObjectWrapper::wrap(v4, scopeObject());
- if (value->isObject())
- callData->thisObject = value;
+ QV4::ReturnedValue scope = QV4::QObjectWrapper::wrap(v4, scopeObject());
+ if (QV4::Value::fromReturnedValue(scope).isObject())
+ callData->thisObject = scope;
}
Q_ASSERT(m_qmlScope.valueRef());
callData->context = *m_qmlScope.valueRef();
- result = v4Function->call(callData);
+ QV4::ReturnedValue res = v4Function->call(callData);
+ QV4::Scope scope(v4);
+ QV4::ScopedValue result(scope, res);
if (v4Function->hasQmlDependencies) {
QV4::Heap::ExecutionContext *c = static_cast<QV4::Heap::ExecutionContext *>(callData->context.m());
// CreateCallContext might have been executed, and that will push a CallContext on top of