fix(ModFolderPage): preserve profile state synchronization during cleanup

Signed-off-by: Vivek Kushwaha <notvivekkushwaha@gmail.com>
This commit is contained in:
Vivek Kushwaha 2026-06-23 17:53:36 +05:30
parent 352b45bf5e
commit 8e85ecfd43
4 changed files with 12 additions and 348 deletions

View file

@ -40,20 +40,10 @@
#include "minecraft/MinecraftInstance.h"
#include "minecraft/mod/ModFolderModel.h"
#include <QThread>
#include <QAtomicInt>
#include <QDebug>
extern QAtomicInt g_logSequence;
extern QString getActiveProfileForModel(void* modelPtr);
ScanModFolders::ScanModFolders(LaunchTask* parent) : LaunchStep(parent) {}
ScanModFolders::~ScanModFolders()
{
qDebug() << "[INSTRUMENTATION]" << ++g_logSequence
<< "ScanModFolders::~ScanModFolders()"
<< "thread:" << QThread::currentThreadId();
}
void ScanModFolders::executeTask()
@ -64,13 +54,6 @@ void ScanModFolders::executeTask()
auto cores = m_inst->coreModList();
auto nils = m_inst->nilModList();
qDebug() << "[INSTRUMENTATION]" << ++g_logSequence
<< "ScanModFolders::executeTask() START"
<< "thread:" << QThread::currentThreadId()
<< "loaderModel:" << loaders << "profile:" << getActiveProfileForModel(loaders)
<< "coreModel:" << cores << "profile:" << getActiveProfileForModel(cores)
<< "nilModel:" << nils << "profile:" << getActiveProfileForModel(nils);
m_modsConnection = connect(loaders, &ModFolderModel::updateFinished, this, &ScanModFolders::modsDone);
if (!loaders->update()) {
m_modsDone = true;
@ -109,17 +92,6 @@ void ScanModFolders::nilModsDone()
void ScanModFolders::checkDone()
{
if (m_modsDone && m_coreModsDone && m_nilModsDone) {
auto m_inst = m_parent->instance();
auto loaders = m_inst->loaderModList();
auto cores = m_inst->coreModList();
auto nils = m_inst->nilModList();
qDebug() << "[INSTRUMENTATION]" << ++g_logSequence
<< "ScanModFolders::checkDone() END"
<< "thread:" << QThread::currentThreadId()
<< "loaderModel:" << loaders << "profile:" << getActiveProfileForModel(loaders)
<< "coreModel:" << cores << "profile:" << getActiveProfileForModel(cores)
<< "nilModel:" << nils << "profile:" << getActiveProfileForModel(nils);
// Sever the connections to the persistent ModFolderModel singletons.
// Without this, updateFinished() would re-invoke these slots the next