forked from quickshell/quickshell
core/scriptmodel: detatch mValues when accessed during update
Fixes iterator invalidation caused by the QML engine.
This commit is contained in:
parent
3a97da0029
commit
ed528268e0
2 changed files with 11 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue