diff options
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 6823cf0000..8bc933b52e 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -1324,15 +1324,5 @@ functionExit: engine->currentStackFrame = frame.parent; engine->jsStackTop = jsStackTop; - if (function->hasQmlDependencies) { - Heap::ExecutionContext *c = static_cast<Heap::ExecutionContext *>(stack[CallData::Context].m()); - // CreateCallContext might have been executed, and that will push a CallContext on top of - // the current one. So, search back to the original QMLContext. - while (c->type != Heap::ExecutionContext::Type_QmlContext) - c = c->outer; - Heap::QmlContext *qc = static_cast<Heap::QmlContext *>(c); - QQmlPropertyCapture::registerQmlDependencies(qc, engine, function->compiledFunction); - } - return ACC.asReturnedValue(); } diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index e40795283a..61879e8b2d 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -231,6 +231,15 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QV4::CallData *callData, b Q_ASSERT(m_qmlScope.valueRef()); callData->context = *m_qmlScope.valueRef(); result = v4Function->call(callData); + 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 + // the current one. So, search back to the original QMLContext. + while (c->type != QV4::Heap::ExecutionContext::Type_QmlContext) + c = c->outer; + QV4::Heap::QmlContext *qc = static_cast<QV4::Heap::QmlContext *>(c); + QQmlPropertyCapture::registerQmlDependencies(qc, v4, v4Function->compiledFunction); + } if (scope.hasException()) { if (watcher.wasDeleted()) |