public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/qt6-qtdeclarative] epel9: QtQml: Invalidate fallback lookups after each call from AOT code
@ 2026-10-08 17:40 Jan Grulich
  0 siblings, 0 replies; only message in thread
From: Jan Grulich @ 2026-10-08 17:40 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/qt6-qtdeclarative
Branch : epel9
Commit : 9b6350e277985bcf79ddfaec889b7dbe2d20579c
Author : Jan Grulich <jgrulich@redhat.com>
Date   : 2025-12-09T14:29:12+01:00
Stats  : +247/-2 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/qt6-qtdeclarative/c/9b6350e277985bcf79ddfaec889b7dbe2d20579c?branch=epel9

Log:
QtQml: Invalidate fallback lookups after each call from AOT code

---
diff --git a/qt6-qtdeclarative.spec b/qt6-qtdeclarative.spec
index a4d78f8..c1ebcb7 100644
--- a/qt6-qtdeclarative.spec
+++ b/qt6-qtdeclarative.spec
@@ -16,7 +16,7 @@
 Summary: Qt6 - QtDeclarative component
 Name:    qt6-%{qt_module}
 Version: 6.10.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0
 Url:     http://www.qt.io
@@ -36,7 +36,7 @@ Source5: qv4global_p-multilib.h
 ## upstream patches
 # https://codereview.qt-project.org/c/qt/qtdeclarative/+/678924
 Patch0:  qtdeclarative-quickshapes-make-module-public.patch
-
+Patch1:  qtdeclarative-qtqml-invalidate-fallback-lookups-after-each-call-from-aot-code.patch
 
 ## upstreamable patches
 
@@ -737,6 +737,9 @@ make check -k -C tests ||:
 %endif
 
 %changelog
+* Tue Dec 09 2025 Jan Grulich <jgrulich@redhat.com> - 6.10.1-2
+- QtQml: Invalidate fallback lookups after each call from AOT code
+
 * Thu Nov 20 2025 Jan Grulich <jgrulich@redhat.com> - 6.10.1-1
 - 6.10.1
 

diff --git a/qtdeclarative-qtqml-invalidate-fallback-lookups-after-each-call-from-aot-code.patch b/qtdeclarative-qtqml-invalidate-fallback-lookups-after-each-call-from-aot-code.patch
new file mode 100644
index 0000000..5d93d81
--- /dev/null
+++ b/qtdeclarative-qtqml-invalidate-fallback-lookups-after-each-call-from-aot-code.patch
@@ -0,0 +1,242 @@
+From 38f99f92126dc9eaedf7129e6022037a7e4b967f Mon Sep 17 00:00:00 2001
+From: Ulf Hermann <ulf.hermann@qt.io>
+Date: Tue, 02 Dec 2025 17:42:30 +0100
+Subject: [PATCH] QtQml: Invalidate fallback lookups after each call from AOT code
+
+Fallback property lookups are created for completely dynamic
+metaobjects. Anything about them may change between any two calls.
+
+Pick-to: 6.8 6.5
+Fixes: QTBUG-142331
+Change-Id: Ib732c37a6f27ab8105bea0eeae000af7eb9c36d7
+Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
+(cherry picked from commit 9af6d2d6d0046b3c8369e15eb4791957cdc7ab7b)
+---
+
+diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h
+index 083c3ec..ef36bf6 100644
+--- a/src/qml/jsruntime/qv4lookup_p.h
++++ b/src/qml/jsruntime/qv4lookup_p.h
+@@ -159,6 +159,10 @@
+             const QQmlPropertyData *propertyData;
+         } qobjectMethodLookup;
+         struct {
++            // NB: None of this is actually cache-able. The metaobject may change at any time.
++            //     We invalidate this data every time the lookup is invoked and thereby force a
++            //     re-initialization next time.
++
+             quintptr isConstant; // This is a bool, encoded as 0 or 1. Both values are ignored by gc
+             quintptr metaObject; // a (const QMetaObject* & 1) or nullptr
+             int coreIndex;
+diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
+index 4e3b4fc..3f0d9e3 100644
+--- a/src/qml/qml/qqml.cpp
++++ b/src/qml/qml/qqml.cpp
+@@ -1386,16 +1386,16 @@
+ 
+ static FallbackPropertyQmlData findFallbackPropertyQmlData(QV4::Lookup *lookup, QObject *object)
+ {
+-    QQmlData *qmlData = QQmlData::get(object);
+-    if (qmlData && qmlData->isQueuedForDeletion)
+-        return {qmlData, nullptr, PropertyResult::Deleted};
++    // We've just initialized the lookup. So everything must be fine here.
+ 
++    QQmlData *qmlData = QQmlData::get(object);
++
++    Q_ASSERT(!qmlData || !qmlData->isQueuedForDeletion);
+     Q_ASSERT(!QQmlData::wasDeleted(object));
+ 
+     const QMetaObject *metaObject
+             = reinterpret_cast<const QMetaObject *>(lookup->qobjectFallbackLookup.metaObject - 1);
+-    if (!metaObject || metaObject != object->metaObject())
+-        return {qmlData, nullptr, PropertyResult::NeedsInit};
++    Q_ASSERT(metaObject == object->metaObject());
+ 
+     return {qmlData, metaObject, PropertyResult::OK};
+ }
+@@ -2585,6 +2585,7 @@
+         break;
+     case QV4::Lookup::Call::ContextGetterScopeObjectPropertyFallback:
+         result = loadFallbackProperty(lookup, qmlScopeObject, target, this);
++        lookup->call = QV4::Lookup::Call::ContextGetterGeneric;
+         break;
+     default:
+         return false;
+@@ -2616,6 +2617,7 @@
+         break;
+     case QV4::Lookup::Call::ContextGetterScopeObjectPropertyFallback:
+         result = writeBackFallbackProperty(lookup, qmlScopeObject, source);
++        lookup->call = QV4::Lookup::Call::ContextGetterGeneric;
+         break;
+     default:
+         return false;
+@@ -2816,6 +2818,7 @@
+         result = lookup->asVariant
+                 ? loadFallbackAsVariant(lookup, object, target, this)
+                 : loadFallbackProperty(lookup, object, target, this);
++        lookup->call = QV4::Lookup::Call::GetterGeneric;
+         break;
+     default:
+         return false;
+@@ -2850,6 +2853,7 @@
+         result = lookup->asVariant
+                 ? writeBackFallbackAsVariant(lookup, object, source)
+                 : writeBackFallbackProperty(lookup, object, source);
++        lookup->call = QV4::Lookup::Call::GetterGeneric;
+         break;
+     default:
+         return false;
+@@ -3010,6 +3014,7 @@
+         result = lookup->asVariant
+                 ? storeFallbackAsVariant(engine->handle(), lookup, object, value)
+                 : storeFallbackProperty(lookup, object, value);
++        lookup->call = QV4::Lookup::Call::SetterGeneric;
+         break;
+     default:
+         return false;
+diff --git a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt
+index 79e908c..67cdefa 100644
+--- a/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt
++++ b/tests/auto/qml/qmlcppcodegen/data/CMakeLists.txt
+@@ -26,6 +26,7 @@
+     multiforeign.h
+     objectwithmethod.h
+     person.cpp person.h
++    propertymap.h
+     qmlusing.h
+     recursiveObject.h
+     refuseWrite.h
+@@ -282,6 +283,7 @@
+     popContextAfterRet.qml
+     prefixedMetaType.qml
+     pressAndHoldButton.qml
++    propertyMap.qml
+     qmlUsing.qml
+     qtbug113150.qml
+     qtfont.qml
+diff --git a/tests/auto/qml/qmlcppcodegen/data/propertyMap.qml b/tests/auto/qml/qmlcppcodegen/data/propertyMap.qml
+new file mode 100644
+index 0000000..c00f397
+--- /dev/null
++++ b/tests/auto/qml/qmlcppcodegen/data/propertyMap.qml
+@@ -0,0 +1,6 @@
++pragma Strict
++import TestTypes
++
++WithPropertyMap {
++    objectName: map.foo
++}
+diff --git a/tests/auto/qml/qmlcppcodegen/data/propertymap.h b/tests/auto/qml/qmlcppcodegen/data/propertymap.h
+new file mode 100644
+index 0000000..64d84c5
+--- /dev/null
++++ b/tests/auto/qml/qmlcppcodegen/data/propertymap.h
+@@ -0,0 +1,40 @@
++// Copyright (C) 2025 The Qt Company Ltd.
++// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
++
++#ifndef PROPERTYMAP_H
++#define PROPERTYMAP_H
++
++#include <QtCore/qobject.h>
++#include <QtQml/qqml.h>
++#include <QtQml/qqmlpropertymap.h>
++
++class WithPropertyMap : public QObject
++{
++    Q_OBJECT
++    QML_ELEMENT
++    Q_PROPERTY(QQmlPropertyMap *map READ map NOTIFY mapChanged)
++public:
++    WithPropertyMap(QObject *parent = nullptr)
++        : QObject(parent)
++        , m_map(new QQmlPropertyMap(this))
++    {
++    }
++
++    QQmlPropertyMap *map() const { return m_map; }
++
++    void setProperties(const QVariantHash &properties)
++    {
++        delete m_map;
++        m_map = new QQmlPropertyMap(this);
++        m_map->insert(properties);
++        emit mapChanged();
++    }
++
++signals:
++    void mapChanged();
++
++private:
++    QQmlPropertyMap *m_map = nullptr;
++};
++
++#endif // PROPERTYMAP_H
+diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+index 70c50b4..a90e2a6 100644
+--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
++++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+@@ -10,6 +10,7 @@
+ #include <data/getOptionalLookup.h>
+ #include <data/listprovider.h>
+ #include <data/objectwithmethod.h>
++#include <data/propertymap.h>
+ #include <data/qmlusing.h>
+ #include <data/refuseWrite.h>
+ #include <data/resettable.h>
+@@ -237,6 +238,7 @@
+     void parentProperty();
+     void popContextAfterRet();
+     void prefixedType();
++    void propertyMap();
+     void propertyOfParent();
+     void qmlUsing();
+     void qtfont();
+@@ -4908,6 +4910,47 @@
+     QCOMPARE(o->property("countH").toInt(), 11);
+ }
+ 
++void tst_QmlCppCodegen::propertyMap()
++{
++    QQmlEngine engine;
++
++    const QUrl document(u"qrc:/qt/qml/TestTypes/propertyMap.qml"_s);
++    QQmlComponent c(&engine, document);
++    QVERIFY2(c.isReady(), qPrintable(c.errorString()));
++
++    QTest::ignoreMessage(
++            QtWarningMsg, qPrintable(
++                document.toString()
++                + u":5:5: QML WithPropertyMap: Unable to assign [undefined] to \"objectName\""));
++
++    QScopedPointer<QObject> o(c.create());
++    QVERIFY(o);
++
++    WithPropertyMap *w = qobject_cast<WithPropertyMap *>(o.data());
++    QVERIFY(w);
++
++    QVERIFY(w->objectName().isEmpty());
++
++    w->setProperties({
++        { u"foo"_s, u"aaa"_s },
++        { u"bar"_s, u"bbb"_s },
++    });
++
++    QCOMPARE(w->objectName(), u"aaa"_s);
++
++    w->setProperties({
++        { u"foo"_s, u"ccc"_s },
++    });
++
++    QCOMPARE(w->objectName(), u"ccc"_s);
++
++    w->setProperties({
++        { u"foo"_s, 24.25 },
++    });
++
++    QCOMPARE(w->objectName(), u"24.25"_s);
++}
++
+ void tst_QmlCppCodegen::propertyOfParent()
+ {
+     QQmlEngine engine;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-08 17:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08 17:40 [rpms/qt6-qtdeclarative] epel9: QtQml: Invalidate fallback lookups after each call from AOT code Jan Grulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox