diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-11-09 17:47:15 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-11-15 06:51:40 +0000 |
commit | 85941a10145ba9165d73ee707d601ace1d639469 (patch) | |
tree | 35538ce66838a99a2badc6637f8b78fe7eabcffe /src/qml/jsruntime/qv4qmlcontext.cpp | |
parent | 6b6d668a0ebc1a15c0a63c9a69a6da2165230caf (diff) |
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
Pick-to: 6.6 6.5
Change-Id: I31db85e74b986c7d9f9d97b5d409e2030cd5f583
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qmlcontext.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4qmlcontext.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index d9d0fe09bf..f032e953b9 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -476,8 +476,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: { ... } @@ -491,7 +491,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."; @@ -527,7 +527,7 @@ ReturnedValue QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(Lookup * } } if (!hasProperty) - return engine->throwReferenceError(name.toQString()); + return engine->throwReferenceError(name->toQString()); return result->asReturnedValue(); } |