fix: prevent container detaching in ResourceFolderModel
and use const accessors whenever we can! Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
c9eb584ac8
commit
0873b8d304
@ -234,7 +234,7 @@ auto ModFolderModel::allMods() -> QList<Mod*>
|
||||
{
|
||||
QList<Mod*> mods;
|
||||
|
||||
for (auto& res : m_resources) {
|
||||
for (auto& res : qAsConst(m_resources)) {
|
||||
mods.append(static_cast<Mod*>(res.get()));
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
auto row = row_it.value();
|
||||
|
||||
auto& new_resource = new_resources[kept];
|
||||
auto const& current_resource = m_resources[row];
|
||||
auto const& current_resource = m_resources.at(row);
|
||||
|
||||
if (new_resource->dateTimeChanged() == current_resource->dateTimeChanged()) {
|
||||
// no significant change, ignore...
|
||||
@ -265,7 +265,7 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
}
|
||||
|
||||
m_resources[row].reset(new_resource);
|
||||
resolveResource(m_resources[row].get());
|
||||
resolveResource(m_resources.at(row).get());
|
||||
emit dataChanged(index(row, 0), index(row, columnCount(QModelIndex()) - 1));
|
||||
}
|
||||
}
|
||||
@ -324,7 +324,7 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
{
|
||||
m_resources_index.clear();
|
||||
int idx = 0;
|
||||
for (auto const& mod : m_resources) {
|
||||
for (auto const& mod : qAsConst(m_resources)) {
|
||||
m_resources_index[mod->internal_id()] = idx;
|
||||
idx++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user