1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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:
|