diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-10-16 08:19:48 +0200 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-10-21 17:53:52 +0000 |
| commit | b74e16668f748b60324851dcaf1545e7b25f184c (patch) | |
| tree | 4369c1c02290488b80ce6ae589db9a85e740d026 | |
| parent | 0f629cbbec2d59f98503174cbbe47354a8af5854 (diff) | |
QtQml: Correctly call type getters on namespaces for AOT code
While this makes no difference in practice, it was technically undefined
behavior before. You cannot call the object getter through the interface
of the context getter.
Amends commit 20d413aaac3e2edd8859b7325805d8fbd35d28e3.
Change-Id: Iab15d4b05a18aa1997e1e0a45aa9df19adf283df
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
(cherry picked from commit adc90d3c15f80011c8c737440ff8593c27b4a711)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 1268040ce2d07b0e1d645f96dfceec57158bff51)
| -rw-r--r-- | src/qml/qml/qqml.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp index 6bfa53b495..6060626188 100644 --- a/src/qml/qml/qqml.cpp +++ b/src/qml/qml/qqml.cpp @@ -1602,7 +1602,13 @@ static void initTypeWrapperLookup( QV4::Scoped<QV4::QQmlTypeWrapper> wrapper( scope, QV4::QQmlTypeWrapper::create( scope.engine, nullptr, context->qmlContext->imports(), importRef)); - wrapper = l->qmlContextPropertyGetter(l, context->engine->handle(), wrapper); + + // This is not a contextGetter since we actually load from the namespace. + wrapper = l->getter(l, context->engine->handle(), wrapper); + + // In theory, the getter may have populated the lookup's property cache. + l->releasePropertyCache(); + l->qmlContextPropertyGetter = qmlContextPropertyGetter; if (qmlContextPropertyGetter == QV4::QQmlContextWrapper::lookupSingleton) l->qmlContextSingletonLookup.singletonObject = wrapper->heapObject(); |
