diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-04-13 09:31:08 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-04-13 09:31:08 +0200 |
| commit | cfa9c677cf86421373fccd46430e2428c4c070d8 (patch) | |
| tree | d535a1bf8796092da1d03241e86ec8ad3df53e18 | |
| parent | 3e4e429fa668b0e95a670d513dfeebddcbb2f7dc (diff) | |
| parent | 4357b541be4b36dbb0f0e6e0e98852b8d1a22bc5 (diff) | |
| download | mullvadvpn-cfa9c677cf86421373fccd46430e2428c4c070d8.tar.xz mullvadvpn-cfa9c677cf86421373fccd46430e2428c4c070d8.zip | |
Merge branch 'try-to-logout-on-quit-event'
| -rw-r--r-- | gui/src/main/index.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 4f398d208d..c39ccdbc5c 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -310,6 +310,7 @@ class ApplicationMain { app.on('ready', this.onReady); app.on('window-all-closed', () => app.quit()); app.on('before-quit', this.onBeforeQuit); + app.on('quit', this.onQuit); } private addSecondInstanceEventHandler() { @@ -382,6 +383,14 @@ class ApplicationMain { } }; + // This is a last try to disconnect and quit gracefully if the app quits without having received + // the before-quit event. + private onQuit = async () => { + if (this.quitStage !== AppQuitStage.ready) { + await this.prepareToQuit(); + } + }; + private onBeforeQuit = async (event: Electron.Event) => { switch (this.quitStage) { case AppQuitStage.unready: |
