Skip to content

Commit

Permalink
send quit to engine upon our own quit
Browse files Browse the repository at this point in the history
  • Loading branch information
rooklift committed Jul 20, 2021
1 parent 92ee9c9 commit 6860b3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/95_hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 9 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 6860b3f

Please sign in to comment.