authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-03-03 20:40:20-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-03-03 22:31:45-08:00
log865d7bd6849de306932bbffabd3a06075313dbc4
treeac85c05de3a91c52d6edcf145e82621584c14877
parent392d63231cce39b2dcd56435ef24579a8b4f06c6

Guard update install while app is quitting

- Prevent update install from running when shutdown is already in progress - Ignore install IPC calls once `isQuitting` is set to avoid duplicate install attempts

1 files changed, 2 insertions(+), 1 deletions(-)

apps/desktop/src/main.ts+2-1
...@@ -641,7 +641,7 @@ async function downloadAvailableUpdate(): Promise<void> {...@@ -641,7 +641,7 @@ async function downloadAvailableUpdate(): Promise<void> {
641}641}
642642
643function installDownloadedUpdate(): void {643function installDownloadedUpdate(): void {
644 if (!updaterConfigured || updateState.status !== "downloaded") return;644 if (isQuitting || !updaterConfigured || updateState.status !== "downloaded") return;
645645
646 isQuitting = true;646 isQuitting = true;
647 clearUpdatePollTimer();647 clearUpdatePollTimer();
...@@ -1030,6 +1030,7 @@ function registerIpcHandlers(): void {...@@ -1030,6 +1030,7 @@ function registerIpcHandlers(): void {
10301030
1031 ipcMain.removeHandler(UPDATE_INSTALL_CHANNEL);1031 ipcMain.removeHandler(UPDATE_INSTALL_CHANNEL);
1032 ipcMain.handle(UPDATE_INSTALL_CHANNEL, async () => {1032 ipcMain.handle(UPDATE_INSTALL_CHANNEL, async () => {
1033 if (isQuitting) return;
1033 installDownloadedUpdate();1034 installDownloadedUpdate();
1034 });1035 });
1035}1036}