core/scriptmodel: detatch mValues when accessed during update

Fixes iterator invalidation caused by the QML engine.
This commit is contained in:
outfoxxed 2025-04-06 01:40:55 -07:00
parent 3a97da0029
commit ed528268e0
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 11 additions and 1 deletions

View file

@ -12,6 +12,7 @@
#include <qvariant.h>
void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
this->hasActiveIterators = true;
this->mValues.reserve(newValues.size());
auto iter = this->mValues.begin();
@ -112,6 +113,8 @@ void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
++newIter;
}
}
this->hasActiveIterators = false;
}
void ScriptModel::setValues(const QVariantList& newValues) {