Skip to content

Commit

Permalink
[Fix] cleanup discord rpc on launch failures (#3888)
Browse files Browse the repository at this point in the history
  • Loading branch information
imLinguin authored Jul 28, 2024
1 parent 8465488 commit 5fc4c8d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/backend/storeManagers/gog/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ export async function launch(
} = await prepareLaunch(gameSettings, gameInfo, isNative(appName))
if (!launchPrepSuccess) {
appendGamePlayLog(gameInfo, `Launch aborted: ${launchPrepFailReason}`)
launchCleanup()
showDialogBoxModalAuto({
title: t('box.error.launchAborted', 'Launch aborted'),
message: launchPrepFailReason!,
Expand Down Expand Up @@ -685,6 +686,8 @@ export async function launch(
}
})

launchCleanup(rpcClient)

if (abort) {
return true
}
Expand All @@ -693,8 +696,6 @@ export async function launch(
logError(['Error launching game:', error], LogPrefix.Gog)
}

launchCleanup(rpcClient)

return !error
}

Expand Down
1 change: 1 addition & 0 deletions src/backend/storeManagers/legendary/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ export async function launch(
} = await prepareLaunch(gameSettings, gameInfo, isNative(appName))
if (!launchPrepSuccess) {
appendGamePlayLog(gameInfo, `Launch aborted: ${launchPrepFailReason}`)
launchCleanup()
showDialogBoxModalAuto({
title: t('box.error.launchAborted', 'Launch aborted'),
message: launchPrepFailReason!,
Expand Down
1 change: 1 addition & 0 deletions src/backend/storeManagers/nile/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export async function launch(

if (!launchPrepSuccess) {
appendGamePlayLog(gameInfo, `Launch aborted: ${launchPrepFailReason}`)
launchCleanup()
showDialogBoxModalAuto({
title: t('box.error.launchAborted', 'Launch aborted'),
message: launchPrepFailReason!,
Expand Down
1 change: 1 addition & 0 deletions src/backend/storeManagers/storeManagerCommon/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export async function launchGame(

if (!launchPrepSuccess) {
appendGamePlayLog(gameInfo, `Launch aborted: ${launchPrepFailReason}`)
launchCleanup()
showDialogBoxModalAuto({
title: i18next.t('box.error.launchAborted', 'Launch aborted'),
message: launchPrepFailReason!,
Expand Down

0 comments on commit 5fc4c8d

Please sign in to comment.