fix: don't mutate QHash while iterating over it

Even though it was using a QMutableHashIterator, sometimes it didn't
work quite well, so this is a bit better.

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-08-05 16:23:46 -03:00
parent f4b207220c
commit 7b27f200b1
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -119,11 +119,9 @@ void EnsureMetadataTask::executeTask()
} }
auto invalidade_leftover = [this] { auto invalidade_leftover = [this] {
QMutableHashIterator<QString, Mod*> mods_iter(m_mods); for (auto mod = m_mods.constBegin(); mod != m_mods.constEnd(); mod++)
while (mods_iter.hasNext()) { emitFail(mod.value(), mod.key(), RemoveFromList::No);
auto mod = mods_iter.next(); m_mods.clear();
emitFail(mod.value(), mod.key());
}
emitSucceeded(); emitSucceeded();
}; };