From bc8aad506273852796731d1a0d001527582d289f Mon Sep 17 00:00:00 2001 From: antelle Date: Fri, 20 Sep 2019 20:35:05 +0200 Subject: [PATCH] fix #1256: error during updating the app --- desktop/app.js | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/desktop/app.js b/desktop/app.js index 747aeded..8b67d8ae 100644 --- a/desktop/app.js +++ b/desktop/app.js @@ -40,23 +40,8 @@ restorePreferences(); app.on('window-all-closed', () => { if (restartPending) { - // unbind all handlers, load new app.js module and pass control to it - app.removeAllListeners('window-all-closed'); - app.removeAllListeners('ready'); - app.removeAllListeners('open-file'); - app.removeAllListeners('activate'); - app.removeAllListeners('second-instance'); - electron.globalShortcut.unregisterAll(); - electron.powerMonitor.removeAllListeners('suspend'); - electron.powerMonitor.removeAllListeners('resume'); - for (const id of systemNotificationIds) { - electron.systemPreferences.unsubscribeNotification(id); - } - systemNotificationIds.length = 0; - const userDataAppFile = path.join(userDataDir, 'app.asar/app.js'); - delete require.cache[require.resolve('./app.js')]; - require(userDataAppFile); - app.emit('ready'); + app.relaunch(); + app.exit(0); } else { if (process.platform !== 'darwin') { app.quit();