[PR #3133] Fix closing to tray from the Windows taskbar #3095

Open
opened 2026-10-14 21:07:27 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3133
Author: @Solution-lab
Created: 9/6/2026
Status: 🔄 Open

Base: dev ← Head: dev


📝 Commits (1)

  • b676e8c Fix Windows close-to-tray behavior by removing native close filter

📊 Changes

1 file changed (+0 additions, -49 deletions)

View changed files

📝 client/core/utils/osSignalHandler.cpp (+0 -49)

📄 Description

Summary

Fix a Windows bug where closing AmneziaVPN from the taskbar terminates the client instead of keeping it running in the system tray.

Bug

The two ways of closing the same window produce different results:

  • Title-bar X: hides the window and keeps the client running in the tray.
  • Taskbar thumbnail X: can terminate the entire client process.

To reproduce:

  1. Launch AmneziaVPN and minimize its window.
  2. Hover over its taskbar icon to display the window thumbnail.
  3. Click the X on the thumbnail.

Expected: The application remains running and accessible from the system tray.

Actual: The client process exits and the tray icon disappears.

Cause

The regression was introduced in [PR #2020](https://github.com/amnezia-vpn/amnezia-client/pull/2020).

WindowsCloseFilter calls forceQuit() for WM_CLOSE whenever GetActiveWindow() differs from the target window. Closing a minimized window through the taskbar can satisfy this condition, causing a normal window-close action to terminate the application.

Changes

Remove WindowsCloseFilter, its registration and cleanup, and the associated unused includes. Window closing now follows Amnezia’s existing Qt close-event handling, which hides the window and keeps the client running.

Why the filter is unnecessary

  • Qt already delivers window-close events to Amnezia’s close-to-tray handler.
  • Qt’s session manager handles WM_QUERYENDSESSION and WM_ENDSESSION for Windows session shutdown and cancellation.
  • The WiX configuration already specifies TerminateProcess="1" in util:CloseApplication. The installer can terminate a client that is still running, using 1 as its exit code, independently of this filter.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/3133 **Author:** [@Solution-lab](https://github.com/Solution-lab) **Created:** 9/6/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (1) - [`b676e8c`](https://github.com/amnezia-vpn/amnezia-client/commit/b676e8c75f10fa3b29d4aaf4c8d46ab049f89257) Fix Windows close-to-tray behavior by removing native close filter ### 📊 Changes **1 file changed** (+0 additions, -49 deletions) <details> <summary>View changed files</summary> 📝 `client/core/utils/osSignalHandler.cpp` (+0 -49) </details> ### 📄 Description ## Summary Fix a Windows bug where **closing AmneziaVPN from the taskbar terminates the client instead of keeping it running in the system tray**. ## Bug The two ways of closing the same window produce different results: - **Title-bar X:** hides the window and keeps the client running in the tray. - **Taskbar thumbnail X:** can terminate the entire client process. To reproduce: 1. Launch AmneziaVPN and minimize its window. 2. Hover over its taskbar icon to display the window thumbnail. 3. Click the X on the thumbnail. **Expected:** The application remains running and accessible from the system tray. **Actual:** The client process exits and the tray icon disappears. ## Cause The regression was introduced in [[PR #2020](https://github.com/amnezia-vpn/amnezia-client/pull/2020)](https://github.com/amnezia-vpn/amnezia-client/pull/2020). `WindowsCloseFilter` calls `forceQuit()` for `WM_CLOSE` whenever `GetActiveWindow()` differs from the target window. Closing a minimized window through the taskbar can satisfy this condition, causing a normal window-close action to terminate the application. ## Changes Remove `WindowsCloseFilter`, its registration and cleanup, and the associated unused includes. Window closing now follows Amnezia’s existing Qt close-event handling, which hides the window and keeps the client running. ## Why the filter is unnecessary - Qt already delivers window-close events to Amnezia’s close-to-tray handler. - Qt’s session manager handles `WM_QUERYENDSESSION` and `WM_ENDSESSION` for Windows session shutdown and cancellation. - The WiX configuration already specifies `TerminateProcess="1"` in `util:CloseApplication`. The installer can terminate a client that is still running, using `1` as its exit code, independently of this filter. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#3095
No description provided.