diff options
author | flow <flowlnlnln@gmail.com> | 2022-09-16 20:02:21 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-09-16 20:12:31 -0300 |
commit | 0873b8d3046db38a8dbdde70a3d7f294c14dcf86 (patch) | |
tree | 14954c4c8502cee1ad7a2143e92ded1306a0fd8a /launcher/minecraft/mod | |
parent | c9eb584ac80956730dd56068945f6791e29716b3 (diff) | |
download | PrismLauncher-0873b8d3046db38a8dbdde70a3d7f294c14dcf86.tar.gz PrismLauncher-0873b8d3046db38a8dbdde70a3d7f294c14dcf86.tar.bz2 PrismLauncher-0873b8d3046db38a8dbdde70a3d7f294c14dcf86.zip |
fix: prevent container detaching in ResourceFolderModel
and use const accessors whenever we can!
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/minecraft/mod')
-rw-r--r-- | launcher/minecraft/mod/ModFolderModel.cpp | 2 | ||||
-rw-r--r-- | launcher/minecraft/mod/ResourceFolderModel.h | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp index 13fed1c9..9aca686f 100644 --- a/launcher/minecraft/mod/ModFolderModel.cpp +++ b/launcher/minecraft/mod/ModFolderModel.cpp @@ -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())); } diff --git a/launcher/minecraft/mod/ResourceFolderModel.h b/launcher/minecraft/mod/ResourceFolderModel.h index 7edbe030..25095a45 100644 --- a/launcher/minecraft/mod/ResourceFolderModel.h +++ b/launcher/minecraft/mod/ResourceFolderModel.h @@ -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++; } |