summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-02-21 18:39:40 +0100
committerOskar Nyberg <oskar@mullvad.net>2023-02-21 18:39:40 +0100
commit68b96d792092acf0e5127684201a85d7628c0632 (patch)
treeddcf6372f0a05134897538bd4d75b534ce6dcc81
parent6c23dacf31fe7c344f1dec90b7665bf3a497fb2d (diff)
parent6369c480a403e79de31543c8430655d0f78f2f0a (diff)
downloadmullvadvpn-68b96d792092acf0e5127684201a85d7628c0632.tar.xz
mullvadvpn-68b96d792092acf0e5127684201a85d7628c0632.zip
Merge branch 'fix-window-not-closing'
-rw-r--r--CHANGELOG.md1
-rw-r--r--gui/src/main/user-interface.ts12
2 files changed, 9 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 86d19580ee..bd070d284b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,7 @@ Line wrap the file at 100 chars. Th
### Fixed
- Fix close to expiry notification not showing unless app is opened once within the last three days
in the desktop app.
+- Fix desktop app not quitting properly after switching from unpinned to pinned window.
#### Android
- Fix adaptive app icon which previously had a displaced nose and some other oddities.
diff --git a/gui/src/main/user-interface.ts b/gui/src/main/user-interface.ts
index bc239cec2c..78e88f0f14 100644
--- a/gui/src/main/user-interface.ts
+++ b/gui/src/main/user-interface.ts
@@ -169,6 +169,8 @@ export default class UserInterface implements WindowControllerDelegate {
// work since the old webContents is destroyed after the IPC wrapper has been updated with the
// new one.
this.windowController.webContents?.removeListener('destroyed', unsetIpcWebContents);
+ // Remove window close handler that calls `preventDefault` when closed.
+ this.windowController.window?.removeListener('close', this.windowCloseHandler);
const window = this.createWindow();
changeIpcWebContents(window.webContents);
@@ -510,12 +512,14 @@ export default class UserInterface implements WindowControllerDelegate {
return;
}
- this.windowController.window?.on('close', (closeEvent: Event) => {
- closeEvent.preventDefault();
- this.windowController.hide();
- });
+ this.windowController.window?.on('close', this.windowCloseHandler);
}
+ private windowCloseHandler = (closeEvent: Event) => {
+ closeEvent.preventDefault();
+ this.windowController.hide();
+ };
+
private installTrayClickHandlers() {
switch (process.platform) {
case 'win32':