From 83cc248141616fa893a4478a55cce378d7853902 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Thu, 9 Nov 2023 17:47:15 +0100 Subject: [PATCH] resolveQmlContextPropertyLookupGetter: Use ScopedPropertyKey We already have a scope, and there is no guarantee that the various calls we do won't cause an allocation, and conseqently trigger the garbage collector Change-Id: I31db85e74b986c7d9f9d97b5d409e2030cd5f583 Reviewed-by: Ulf Hermann (cherry picked from commit 85941a10145ba9165d73ee707d601ace1d639469) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit ea9bc31986f72b3bcbc43a0dd8930f17af952105) --- src/qml/jsruntime/qv4qmlcontext.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index 58c5df5c39..9c4cdce578 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -475,8 +475,8 @@ ReturnedValue QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(Lookup * { Scope scope(engine); auto *func = engine->currentStackFrame->v4Function; - PropertyKey name =engine->identifierTable->asPropertyKey( - func->compilationUnit->runtimeStrings[l->nameIndex]); + ScopedPropertyKey name(scope, engine->identifierTable->asPropertyKey( + func->compilationUnit->runtimeStrings[l->nameIndex])); // Special hack for bounded signal expressions, where the parameters of signals are injected // into the handler expression through the locals of the call context. So for onClicked: { ... } @@ -490,7 +490,7 @@ ReturnedValue QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(Lookup * const auto location = func->sourceLocation(); qCWarning(lcQmlContext).nospace().noquote() << location.sourceFile << ":" << location.line << ":" << location.column - << " Parameter \"" << name.toQString() << "\" is not declared." + << " Parameter \"" << name->toQString() << "\" is not declared." << " Injection of parameters into signal handlers is deprecated." << " Use JavaScript functions with formal parameters instead."; @@ -526,7 +526,7 @@ ReturnedValue QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(Lookup * } } if (!hasProperty) - return engine->throwReferenceError(name.toQString()); + return engine->throwReferenceError(name->toQString()); return result->asReturnedValue(); }