fix: prevent deletes by shared pointer accidental creation
This fixes the launcher crashing when opening the game :iea: Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
10493bd44a
commit
c9eb584ac8
@ -706,7 +706,7 @@ QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, Minecr
|
||||
{
|
||||
out << QString("%1:").arg(label);
|
||||
auto modList = model.allMods();
|
||||
std::sort(modList.begin(), modList.end(), [](Mod::Ptr a, Mod::Ptr b) {
|
||||
std::sort(modList.begin(), modList.end(), [](auto a, auto b) {
|
||||
auto aName = a->fileinfo().completeBaseName();
|
||||
auto bName = b->fileinfo().completeBaseName();
|
||||
return aName.localeAwareCompare(bName) < 0;
|
||||
|
@ -251,7 +251,7 @@ bool ResourceFolderModel::update()
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResourceFolderModel::resolveResource(Resource::Ptr res)
|
||||
void ResourceFolderModel::resolveResource(Resource* res)
|
||||
{
|
||||
if (!res->shouldResolve()) {
|
||||
return;
|
||||
|
@ -68,7 +68,7 @@ class ResourceFolderModel : public QAbstractListModel {
|
||||
virtual bool update();
|
||||
|
||||
/** Creates a new parse task, if needed, for 'res' and start it.*/
|
||||
virtual void resolveResource(Resource::Ptr res);
|
||||
virtual void resolveResource(Resource* res);
|
||||
|
||||
[[nodiscard]] size_t size() const { return m_resources.size(); };
|
||||
[[nodiscard]] bool empty() const { return size() == 0; }
|
||||
@ -265,7 +265,7 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
}
|
||||
|
||||
m_resources[row].reset(new_resource);
|
||||
resolveResource(m_resources.at(row));
|
||||
resolveResource(m_resources[row].get());
|
||||
emit dataChanged(index(row, 0), index(row, columnCount(QModelIndex()) - 1));
|
||||
}
|
||||
}
|
||||
@ -313,7 +313,7 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
for (auto& added : added_set) {
|
||||
auto res = new_resources[added];
|
||||
m_resources.append(res);
|
||||
resolveResource(res);
|
||||
resolveResource(m_resources.last().get());
|
||||
}
|
||||
|
||||
endInsertRows();
|
||||
|
@ -99,7 +99,7 @@ void ModFolderLoadTask::executeTask()
|
||||
// Remove orphan metadata to prevent issues
|
||||
// See https://github.com/PolyMC/PolyMC/issues/996
|
||||
if (m_clean_orphan) {
|
||||
QMutableMapIterator<QString, Mod::Ptr> iter(m_result->mods);
|
||||
QMutableMapIterator iter(m_result->mods);
|
||||
while (iter.hasNext()) {
|
||||
auto mod = iter.next().value();
|
||||
if (mod->status() == ModStatus::NotInstalled) {
|
||||
|
Loading…
Reference in New Issue
Block a user