From 88399957efc772d21e16b167b87da95aa09770bb Mon Sep 17 00:00:00 2001 From: Igor Gassmann Date: Sat, 17 Mar 2018 16:44:46 -0400 Subject: [PATCH] fix: app quitting when accepting update (#1118) The app wouldn't completely quit after an update was downloaded and the user has pressed "USE IT NOW". --- src/main/createWindow.js | 2 +- src/main/index.js | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/createWindow.js b/src/main/createWindow.js index ce54fe053..06d222e96 100644 --- a/src/main/createWindow.js +++ b/src/main/createWindow.js @@ -49,7 +49,7 @@ export default appState => { setupContextMenu(window); window.on('close', event => { - if (!appState.isQuitting) { + if (!appState.isQuitting && !appState.autoUpdateAccepted) { event.preventDefault(); window.hide(); } diff --git a/src/main/index.js b/src/main/index.js index 22875c708..a1947739d 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -19,9 +19,6 @@ autoUpdater.autoDownload = true; // it will still install on shutdown. let autoUpdateDownloaded = false; -// Keeps track of whether the user has accepted an auto-update through the interface. -let autoUpdateAccepted = false; - // This is used to keep track of whether we are showing the special dialog // that we show on Windows after you decline an upgrade and close the app later. let showingAutoUpdateCloseAlert = false; @@ -88,7 +85,7 @@ app.on('will-quit', event => { if ( process.platform === 'win32' && autoUpdateDownloaded && - !autoUpdateAccepted && + !appState.autoUpdateAccepted && !showingAutoUpdateCloseAlert ) { // We're on Win and have an update downloaded, but the user declined it (or closed @@ -152,7 +149,7 @@ autoUpdater.on('update-downloaded', () => { }); ipcMain.on('autoUpdateAccepted', () => { - autoUpdateAccepted = true; + appState.autoUpdateAccepted = true; autoUpdater.quitAndInstall(); });