aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4sequenceobject.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-08-27 14:32:49 +0200
committerUlf Hermann <ulf.hermann@qt.io>2025-09-01 19:25:21 +0200
commit2aeafa46990c4211ece4ee173de69ec2b88577ac (patch)
treee984ad45335f2141ed2ce57d0f8fc068d966bc88 /src/qml/jsruntime/qv4sequenceobject.cpp
parent609a06be462088044cb84999d86eb5fd2fbb0e81 (diff)
QtQml: Heap::Sequence::isReference() where appropriate
In order to determine whether we need to write back, conceptually we need to know whether the sequence is a reference. That happens to be the case if there is an object to write back to, but that's not how object() was meant to be used. Pick-to: 6.10 6.9 6.8 Task-number: QTBUG-129972 Task-number: QTBUG-139025 Change-Id: Ie3e0e0318ecabd6f25d545d1198c07a0037b68fe Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4sequenceobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index e61fc47ce4..3d203d91d4 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -259,14 +259,14 @@ static void removeLastInline(Heap::Sequence *p, qsizetype num)
bool Heap::Sequence::loadReference()
{
- Q_ASSERT(object());
+ Q_ASSERT(isReference());
// If locations are enforced we only read once
return enforcesLocation() || QV4::ReferenceObject::readReference(this);
}
bool Heap::Sequence::storeReference()
{
- Q_ASSERT(object());
+ Q_ASSERT(isReference());
return isAttachedToProperty() && QV4::ReferenceObject::writeBack(this);
}
@@ -348,7 +348,7 @@ bool Sequence::virtualPut(Managed *that, PropertyKey id, const Value &value, Val
appendInline(p, element);
}
- if (p->object())
+ if (p->isReference())
p->storeReference();
return true;
}
@@ -379,7 +379,7 @@ bool Sequence::virtualDeleteProperty(Managed *that, PropertyKey id)
/* but we cannot, so we insert a default-value instead. */
replaceInline(p, index, QVariant());
- if (p->object())
+ if (p->isReference())
p->storeReference();
return true;
@@ -517,7 +517,7 @@ QV4::ReturnedValue SequencePrototype::method_setLength(
}
/* write back if required. */
- if (p->object())
+ if (p->isReference())
p->storeReference();
RETURN_UNDEFINED();
@@ -573,7 +573,7 @@ ReturnedValue SequencePrototype::method_shift(
m.removeValueAtEnd(storage);
}
- if (p->object())
+ if (p->isReference())
p->storeReference();
return scope.engine->fromVariant(shifted);