From 5559fc61b19da67eeef690146a56541f5a187b35 Mon Sep 17 00:00:00 2001 From: theolivenbaum Date: Wed, 8 Sep 2021 08:47:16 +0200 Subject: [PATCH] force-destroy all windows on before-quit-for-update --- ElectronNET.Host/main.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ElectronNET.Host/main.js b/ElectronNET.Host/main.js index f7c4d05..e3b9741 100644 --- a/ElectronNET.Host/main.js +++ b/ElectronNET.Host/main.js @@ -51,6 +51,20 @@ app.on('will-finish-launching', () => { app.on('before-quit-for-update', () => { ignoreApiProcessClosed = true; + + const windows = BrowserWindow.getAllWindows(); + if (windows.length) { + windows.forEach(w => { + try { + w.hide(); + w.destroy(); + } + catch { + //ignore, probably already destroyed + } + }); + } + }); const manifestJsonFile = require(manifestJsonFilePath);