commit:     3bac5d602c87f94892984f658e4ecc915c434d10
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 10 22:46:53 2025 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Wed Dec 10 23:00:27 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3bac5d60

dev-qt/qtdeclarative: backport QTBUG-142331 crash fix

According to the bug 6.9.3 should be affected too, but going to leave
that one alone at this point. Still a few blockers before can stabilize
6.10.1 but it shouldn't take all that long at this point.

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../files/qtdeclarative-6.10.1-QTBUG-142331.patch  | 66 ++++++++++++++++++++++
 ....10.1.ebuild => qtdeclarative-6.10.1-r1.ebuild} |  4 ++
 2 files changed, 70 insertions(+)

diff --git a/dev-qt/qtdeclarative/files/qtdeclarative-6.10.1-QTBUG-142331.patch 
b/dev-qt/qtdeclarative/files/qtdeclarative-6.10.1-QTBUG-142331.patch
new file mode 100644
index 000000000000..7109559a29a2
--- /dev/null
+++ b/dev-qt/qtdeclarative/files/qtdeclarative-6.10.1-QTBUG-142331.patch
@@ -0,0 +1,66 @@
+https://qt-project.atlassian.net/browse/QTBUG-142331
+https://mail.kde.org/pipermail/distributions/2025-December/001648.html
+https://bugs.kde.org/show_bug.cgi?id=512754
+https://codereview.qt-project.org/c/qt/qtdeclarative/+/696524
+--- a/src/qml/jsruntime/qv4lookup_p.h
++++ b/src/qml/jsruntime/qv4lookup_p.h
+@@ -160,4 +160,8 @@
+         } 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
+--- a/src/qml/qml/qqml.cpp
++++ b/src/qml/qml/qqml.cpp
+@@ -1378,14 +1378,14 @@
+ static FallbackPropertyQmlData findFallbackPropertyQmlData(QV4::Lookup 
*lookup, QObject *object)
+ {
++    // We've just initialized the lookup. So everything must be fine here.
++
+     QQmlData *qmlData = QQmlData::get(object);
+-    if (qmlData && qmlData->isQueuedForDeletion)
+-        return {qmlData, nullptr, PropertyResult::Deleted};
+ 
++    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};
+@@ -2577,4 +2577,5 @@
+     case QV4::Lookup::Call::ContextGetterScopeObjectPropertyFallback:
+         result = loadFallbackProperty(lookup, qmlScopeObject, target, this);
++        lookup->call = QV4::Lookup::Call::ContextGetterGeneric;
+         break;
+     default:
+@@ -2608,4 +2609,5 @@
+     case QV4::Lookup::Call::ContextGetterScopeObjectPropertyFallback:
+         result = writeBackFallbackProperty(lookup, qmlScopeObject, source);
++        lookup->call = QV4::Lookup::Call::ContextGetterGeneric;
+         break;
+     default:
+@@ -2808,4 +2810,5 @@
+                 ? loadFallbackAsVariant(lookup, object, target, this)
+                 : loadFallbackProperty(lookup, object, target, this);
++        lookup->call = QV4::Lookup::Call::GetterGeneric;
+         break;
+     default:
+@@ -2842,4 +2845,5 @@
+                 ? writeBackFallbackAsVariant(lookup, object, source)
+                 : writeBackFallbackProperty(lookup, object, source);
++        lookup->call = QV4::Lookup::Call::GetterGeneric;
+         break;
+     default:
+@@ -3002,4 +3006,5 @@
+                 ? storeFallbackAsVariant(engine->handle(), lookup, object, 
value)
+                 : storeFallbackProperty(lookup, object, value);
++        lookup->call = QV4::Lookup::Call::SetterGeneric;
+         break;
+     default:

diff --git a/dev-qt/qtdeclarative/qtdeclarative-6.10.1.ebuild 
b/dev-qt/qtdeclarative/qtdeclarative-6.10.1-r1.ebuild
similarity index 96%
rename from dev-qt/qtdeclarative/qtdeclarative-6.10.1.ebuild
rename to dev-qt/qtdeclarative/qtdeclarative-6.10.1-r1.ebuild
index eb34cbcde726..43c9a1f694de 100644
--- a/dev-qt/qtdeclarative/qtdeclarative-6.10.1.ebuild
+++ b/dev-qt/qtdeclarative/qtdeclarative-6.10.1-r1.ebuild
@@ -32,6 +32,10 @@ BDEPEND="
        ~dev-qt/qtshadertools-${PV}:6
 "
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-6.10.1-QTBUG-142331.patch
+)
+
 src_configure() {
        local mycmakeargs=(
                $(cmake_use_find_package qmlls Qt6LanguageServerPrivate)

Reply via email to