[PR #3414] fix(ui): prepare VPN configuration before tray connections #3289

Open
opened 2026-11-07 17:58:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3414
Author: @archymed
Created: 11/5/2026
Status: 🔄 Open

Base: dev ← Head: fix/tray-connect-preparation


📝 Commits (1)

  • 6a8c0fb fix(ui): prepare VPN configuration before tray connections

📊 Changes

2 files changed (+50 additions, -2 deletions)

View changed files

📝 client/core/controllers/coreSignalHandlers.cpp (+1 -1)
📝 client/tests/testConnection.cpp (+49 -1)

📄 Description

Issue

On a fresh installation, clicking Connect in the tray icon's menu can crash AmneziaVPN if the user has not connected through the main window yet. Connecting through the main window once makes subsequent tray connections work.

Env & version

  • OS: Omarchy 4.0.6 (Arch Linux based)
  • Desktop: Hyprland
  • Kernel: 7.2.15-1-omarchy
  • AmneziaVPN: 5.1.0.6

Steps to reproduce

  1. Install AmneziaVPN on a machine where it has not been used before.
  2. Launch the application and add your VPN configuration.
  3. Do not click Connect in the main application window.
  4. Right-click the AmneziaVPN tray icon in the top bar.
  5. Click Connect in the context menu.

Actual: AmneziaVPN crashes. This was reproduced twice on the affected installation.

Expected: AmneziaVPN prepares the selected connection and connects, or displays an error if it cannot proceed.

Workaround: Relaunch AmneziaVPN, open its main window, and connect there once. After this, connecting from the tray menu works.

Root Cause

The tray's Connect action skips the checks and setup performed by the main window's Connect button. It tries to start the VPN immediately, even when the connection configuration is not ready. The crash dump shows the app trying to use a missing configuration handler.

Fix

  • Change the tray connection in coreSignalHandlers.cpp to call ConnectionUiController::toggleConnection() instead of openConnection().
  • This reuses the main window's existing validation and configuration preparation before starting the VPN.
  • Add regression tests for tray Connect with an unprepared server and while connection preparation is already in progress.

Validation

  • Confirmed the original crash with a local core dump and traced the tray action in the source.
  • git diff --check passed.
  • Qt moc processed the updated test file and registered both new test cases.
  • Full build, regression test execution, and verification of the patched app have not been performed.

🔄 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/3414 **Author:** [@archymed](https://github.com/archymed) **Created:** 11/5/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `fix/tray-connect-preparation` --- ### 📝 Commits (1) - [`6a8c0fb`](https://github.com/amnezia-vpn/amnezia-client/commit/6a8c0fb8721db8bb7ddfb0ec968ae773469ea145) fix(ui): prepare VPN configuration before tray connections ### 📊 Changes **2 files changed** (+50 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `client/core/controllers/coreSignalHandlers.cpp` (+1 -1) 📝 `client/tests/testConnection.cpp` (+49 -1) </details> ### 📄 Description ## Issue On a fresh installation, clicking **Connect** in the tray icon's menu can crash AmneziaVPN if the user has not connected through the main window yet. Connecting through the main window once makes subsequent tray connections work. ## Env & version - OS: Omarchy 4.0.6 (Arch Linux based) - Desktop: Hyprland - Kernel: 7.2.15-1-omarchy - AmneziaVPN: 5.1.0.6 ## Steps to reproduce 1. Install AmneziaVPN on a machine where it has not been used before. 2. Launch the application and add your VPN configuration. 3. Do **not** click **Connect** in the main application window. 4. Right-click the AmneziaVPN tray icon in the top bar. 5. Click **Connect** in the context menu. **Actual:** AmneziaVPN crashes. This was reproduced twice on the affected installation. **Expected:** AmneziaVPN prepares the selected connection and connects, or displays an error if it cannot proceed. **Workaround:** Relaunch AmneziaVPN, open its main window, and connect there once. After this, connecting from the tray menu works. ## Root Cause The tray's **Connect** action skips the checks and setup performed by the main window's **Connect** button. It tries to start the VPN immediately, even when the connection configuration is not ready. The crash dump shows the app trying to use a missing configuration handler. ## Fix - Change the tray connection in `coreSignalHandlers.cpp` to call `ConnectionUiController::toggleConnection()` instead of `openConnection()`. - This reuses the main window's existing validation and configuration preparation before starting the VPN. - Add regression tests for tray Connect with an unprepared server and while connection preparation is already in progress. ## Validation - Confirmed the original crash with a local core dump and traced the tray action in the source. - `git diff --check` passed. - Qt `moc` processed the updated test file and registered both new test cases. - Full build, regression test execution, and verification of the patched app have not been performed. --- <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#3289
No description provided.