fix(PackProfile): overwrite update task when it has different network mode

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2026-03-19 10:54:15 +05:00
parent 04786023b0
commit cd006d642b
No known key found for this signature in database
GPG key ID: B77C34313AEE1FFF
4 changed files with 16 additions and 2 deletions

View file

@ -74,6 +74,11 @@ bool ComponentUpdateTask::abort()
return aborted;
}
Net::Mode ComponentUpdateTask::netMode()
{
return d->netmode;
}
void ComponentUpdateTask::executeTask()
{
qCDebug(instanceProfileResolveC) << "Loading components";

View file

@ -19,6 +19,7 @@ class ComponentUpdateTask : public Task {
bool canAbort() const override;
bool abort() override;
Net::Mode netMode();
protected:
void executeTask() override;

View file

@ -326,7 +326,15 @@ PackProfile::Result PackProfile::reload(Net::Mode netmode)
{
// Do not reload when the update/resolve task is running. It is in control.
if (d->m_updateTask) {
return Result::Success();
if (d->m_updateTask->netMode() == netmode) {
return Result::Success();
}
// https://github.com/PrismLauncher/PrismLauncher/issues/5209
// FIXME: HACK HACK HACK
disconnect(d->m_updateTask.get(), &ComponentUpdateTask::aborted, nullptr, nullptr);
d->m_updateTask->abort();
d->m_updateTask.reset();
}
// flush any scheduled saves to not lose state

View file

@ -22,7 +22,7 @@ struct PackProfileData {
ComponentIndex componentIndex;
bool dirty = false;
QTimer m_saveTimer;
Task::Ptr m_updateTask;
shared_qobject_ptr<ComponentUpdateTask> m_updateTask;
bool loaded = false;
bool interactionDisabled = true;
};