[PR #427] fix(linux): correct single-instance detection order #395

Open
opened 2026-03-02 12:41:01 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kavishdevar/librepods/pull/427
Author: @bhdai
Created: 1/14/2026
Status: 🔄 Open

Base: mainHead: fix/single-instance-detection


📝 Commits (2)

  • 97cb02c fix(linux): correct single-instance detection order
  • b2043c9 fix: ai suggestion

📊 Changes

1 file changed (+3 additions, -11 deletions)

View changed files

📝 linux/main.cpp (+3 -11)

📄 Description

problem

When launching the app while an instance is already running, a new instance starts instead of bringing the existing window to focus. This results in duplicate system tray icons.

The socket cleanup was running BEFORE the connection check,causing every new launch to delete the socket before attempting to detect an existing instance.

solution

Reorder the logic in main():

  1. First - Attempt to connect to existing server
  2. If connected - Send "reopen" message and exit (another instance is running)
  3. If connection fails - Clean up any stale socket files, then start the server

Summary by CodeRabbit

  • Bug Fixes
    • Improved startup cleanup so temporary IPC artifacts are only removed when the app proceeds as the active instance; this prevents accidental removal when another instance is running and preserves cleanup after quit. No changes to public APIs.

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 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/kavishdevar/librepods/pull/427 **Author:** [@bhdai](https://github.com/bhdai) **Created:** 1/14/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/single-instance-detection` --- ### 📝 Commits (2) - [`97cb02c`](https://github.com/kavishdevar/librepods/commit/97cb02c191f46d731ea9e673f268e3fc1ed1fb94) fix(linux): correct single-instance detection order - [`b2043c9`](https://github.com/kavishdevar/librepods/commit/b2043c9daad13c3f31674808f41273d2a01319c8) fix: ai suggestion ### 📊 Changes **1 file changed** (+3 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `linux/main.cpp` (+3 -11) </details> ### 📄 Description ### problem When launching the app while an instance is already running, a new instance starts instead of bringing the existing window to focus. This results in duplicate system tray icons. The socket cleanup was running BEFORE the connection check,causing every new launch to delete the socket before attempting to detect an existing instance. ### solution Reorder the logic in `main()`: 1. **First** - Attempt to connect to existing server 2. **If connected** - Send "reopen" message and exit (another instance is running) 3. **If connection fails** - Clean up any stale socket files, then start the server <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved startup cleanup so temporary IPC artifacts are only removed when the app proceeds as the active instance; this prevents accidental removal when another instance is running and preserves cleanup after quit. No changes to public APIs. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <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 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
starred/librepods#395
No description provided.