From 070c800ce95c1f611132056daf77402973deccd6 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Mon, 26 Jan 2026 21:48:27 +0500 Subject: [PATCH] fix(PackProfile): don't reset dirty if component list saving failed Signed-off-by: Octol1ttle (cherry picked from commit c6072ff4349be87864fc414d0010cc3eb24ed61c) --- launcher/minecraft/PackProfile.cpp | 13 ++++++++----- launcher/minecraft/PackProfile.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp index 4160351b4..4cf1c7c17 100644 --- a/launcher/minecraft/PackProfile.cpp +++ b/launcher/minecraft/PackProfile.cpp @@ -167,6 +167,7 @@ static bool savePackProfile(const QString& filename, const ComponentContainer& c } if (!outFile.commit()) { qCCritical(instanceProfileC) << "Couldn't save" << outFile.fileName() << "because:" << outFile.errorString(); + return false; } return true; } @@ -229,9 +230,8 @@ static PackProfile::Result loadPackProfile(PackProfile* parent, void PackProfile::saveNow() { - if (saveIsScheduled()) { + if (saveIsScheduled() && save_internal()) { d->m_saveTimer.stop(); - save_internal(); } } @@ -279,12 +279,15 @@ QString PackProfile::patchFilePathForUid(const QString& uid) const return patchesPattern().arg(uid); } -void PackProfile::save_internal() +bool PackProfile::save_internal() { qDebug() << d->m_instance->name() << "|" << "Component list save performed now"; auto filename = componentsFilePath(); - savePackProfile(filename, d->components); - d->dirty = false; + if (savePackProfile(filename, d->components)) { + d->dirty = false; + return true; + } + return false; } PackProfile::Result PackProfile::load() diff --git a/launcher/minecraft/PackProfile.h b/launcher/minecraft/PackProfile.h index d812dfa48..70dd04514 100644 --- a/launcher/minecraft/PackProfile.h +++ b/launcher/minecraft/PackProfile.h @@ -175,7 +175,7 @@ class PackProfile : public QAbstractListModel { QString patchesPattern() const; private slots: - void save_internal(); + bool save_internal(); void updateSucceeded(); void updateFailed(const QString& error); void componentDataChanged();