aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4qmlcontext.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp
index 12ada7ee70..0c5226d46c 100644
--- a/src/qml/jsruntime/qv4qmlcontext.cpp
+++ b/src/qml/jsruntime/qv4qmlcontext.cpp
@@ -458,11 +458,17 @@ ReturnedValue QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(Lookup *
// into the handler expression through the locals of the call context. So for onClicked: { ... }
// the parameters of the clicked signal are injected and we must allow for them to be found here
// before any other property from the QML context.
- ExecutionContext &ctx = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context);
- if (ctx.d()->type == Heap::ExecutionContext::Type_CallContext) {
- uint index = ctx.d()->internalClass->indexOfValueOrGetter(name);
- if (index < UINT_MAX)
- return static_cast<Heap::CallContext*>(ctx.d())->locals[index].asReturnedValue();
+ for (Heap::ExecutionContext *ctx = engine->currentContext()->d(); ctx; ctx = ctx->outer) {
+ if (ctx->type == Heap::ExecutionContext::Type_CallContext) {
+ const uint index = ctx->internalClass->indexOfValueOrGetter(name);
+ if (index < std::numeric_limits<uint>::max())
+ return static_cast<Heap::CallContext *>(ctx)->locals[index].asReturnedValue();
+ }
+
+ // Skip only block contexts within the current call context.
+ // Other contexts need a regular QML property lookup. See below.
+ if (ctx->type != Heap::ExecutionContext::Type_BlockContext)
+ break;
}
bool hasProperty = false;