From 834eb5a90dd943888075274aca12cf5208d21484 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sat, 7 Jun 2025 16:32:40 +0100 Subject: [PATCH 1/3] Don't retry account refresh if aborted Signed-off-by: TheKodeToad --- launcher/LaunchController.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index b1a956b49..824738b6c 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -200,7 +200,7 @@ void LaunchController::login() if ((m_accountToUse->accountType() != AccountType::Offline && m_accountToUse->accountState() == AccountState::Offline) || m_accountToUse->shouldRefresh()) { // Force account refresh on the account used to launch the instance updating the AccountState - // only on first try and if it is not meant to be offline + // only on first try and if it is not meant to be offline m_accountToUse->refresh(); } while (tryagain) { @@ -296,11 +296,21 @@ void LaunchController::login() case AccountState::Working: { // refresh is in progress, we need to wait for it to finish to proceed. ProgressDialog progDialog(m_parentWidget); - if (m_online) { - progDialog.setSkipButton(true, tr("Play Offline")); - } + progDialog.setSkipButton(true, tr("Abort")); + auto task = accountToCheck->currentTask(); + + bool aborted = false; + auto abortListener = connect(task.get(), &Task::aborted, [&aborted] { aborted = true; }); + progDialog.execWithTask(task.get()); + + disconnect(abortListener); + + // don't retry if aborted + if (aborted) + tryagain = false; + continue; } case AccountState::Expired: { From 06aece111ac223c076c0042af86f09428a727050 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sat, 7 Jun 2025 20:24:32 +0100 Subject: [PATCH 2/3] Reset account state on abort Signed-off-by: TheKodeToad --- launcher/minecraft/auth/MinecraftAccount.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/launcher/minecraft/auth/MinecraftAccount.cpp b/launcher/minecraft/auth/MinecraftAccount.cpp index 86e9cc511..ca052c378 100644 --- a/launcher/minecraft/auth/MinecraftAccount.cpp +++ b/launcher/minecraft/auth/MinecraftAccount.cpp @@ -181,8 +181,10 @@ void MinecraftAccount::authFailed(QString reason) data.validity_ = Validity::None; emit changed(); } break; + case AccountTaskState::STATE_WORKING: { + data.accountState = AccountState::Unchecked; + } break; case AccountTaskState::STATE_CREATED: - case AccountTaskState::STATE_WORKING: case AccountTaskState::STATE_SUCCEEDED: { // Not reachable here, as they are not failures. } From a195b9981d5f42849ed565c58dff673550c42f01 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sat, 7 Jun 2025 22:41:09 +0100 Subject: [PATCH 3/3] Use Task::getState Signed-off-by: TheKodeToad --- launcher/LaunchController.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp index 824738b6c..26f539e15 100644 --- a/launcher/LaunchController.cpp +++ b/launcher/LaunchController.cpp @@ -299,16 +299,10 @@ void LaunchController::login() progDialog.setSkipButton(true, tr("Abort")); auto task = accountToCheck->currentTask(); - - bool aborted = false; - auto abortListener = connect(task.get(), &Task::aborted, [&aborted] { aborted = true; }); - progDialog.execWithTask(task.get()); - disconnect(abortListener); - // don't retry if aborted - if (aborted) + if (task->getState() == Task::State::AbortedByUser) tryagain = false; continue;