From 6860b3fb5ab8b8a0e68d0f78e8dfa109c11553a5 Mon Sep 17 00:00:00 2001 From: rooklift <16438795+rooklift@users.noreply.github.com> Date: Tue, 20 Jul 2021 17:41:11 +0100 Subject: [PATCH] send quit to engine upon our own quit --- src/95_hub.js | 5 +++++ src/main.js | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/src/95_hub.js b/src/95_hub.js index 604a879f..2b6ed991 100644 --- a/src/95_hub.js +++ b/src/95_hub.js @@ -2251,6 +2251,11 @@ let hub_props = { // --------------------------------------------------------------------------------------------------------------------- // Misc... + quit: function() { + this.engine.shutdown(); + ipcRenderer.send("terminate"); + }, + set_special_message: function(s, css_class, duration) { this.status_handler.set_special_message(s, css_class, duration); this.draw_statusbox(); diff --git a/src/main.js b/src/main.js index 45e729e6..0c6f94a1 100644 --- a/src/main.js +++ b/src/main.js @@ -90,6 +90,15 @@ function startup() { alert(messages.renderer_hang); }); + win.once("close", (event) => { // Note the once... + event.preventDefault(); // We prevent the close one time only, + win.webContents.send("call", "quit"); // to let renderer's "quit" method run once. It then sends "terminate" back. + }); + + electron.ipcMain.on("terminate", () => { + win.close(); + }); + electron.app.on("window-all-closed", () => { electron.app.quit(); });