diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-09-29 22:22:12 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-10-23 06:27:57 +0000 |
commit | 4071102bf1fde2afba8a2ed11c41a9e86888d8a5 (patch) | |
tree | c68a9ea9dec137b798f79cc89e1860ee51976223 /src/qml/qml/qqmljavascriptexpression.cpp | |
parent | 2f1e755a623bc834f91204d7414a3588b4f3b5d9 (diff) |
Move the registration of QML dependencies to where it belongs
The only plaec we can possibly have those dependencies is when
we execute JS code from QQmlJavascriptExpression, so let's also more
the dependency registration there.
Change-Id: I12e7c69f7d126027e4fd9e73355173a45be01c65
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/qml/qqmljavascriptexpression.cpp')
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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()) |