Overwrite component update task when it has different network mode (#5216)

This commit is contained in:
Rachel Powers 2026-03-20 23:29:49 +00:00 committed by GitHub
commit 731866c577
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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;
};