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 <ulf.hermann@qt.io>
(cherry picked from commit 85941a1014)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ea9bc31986)
This commit is contained in:
Fabian Kosmale 2023-11-09 17:47:15 +01:00 committed by Qt Cherry-pick Bot
parent 9a3ae2c1f9
commit 83cc248141
1 changed files with 4 additions and 4 deletions

View File

@ -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();
}