Skip to content

Conversation

@GeneralGDA
Copy link
Contributor

On Windows, launching a second instance didn't even reach the lock acquisition - the application crashed earlier. Now there are no console errors when launching the second application. And there's no window flickering when selecting jump list elements. The main window is also correctly displayed when launching a second instance.

In start.ts, the real changes are only at the beginning of the file. Everything else that was touched is just indentation, in order to 'wrap' all the code into a function.

Application startup and quit logic improvements:

  • Moved the single-instance lock (app.requestSingleInstanceLock()) and related quit logic to the top of the startup file, ensuring the application quits early if another instance is running. The quitApplication function is now used consistently for quitting the app. [1] [2] [3] [4]
  • Updated all calls to app.quit() to use the new quitApplication function, ensuring consistent handling of the isQuiting flag across the codebase. [1] [2]

Other improvements:

  • Fixed a minor issue in desktop/src/main/windowsSpecificSetup.ts by replacing a return statement with a break in a switch-case default clause for better code clarity and correctness.

Signed-off-by: Denis Gladkiy <denis.gladkiy@hardcoreeng.com>
@huly-github-staging
Copy link

Connected to Huly®: UBERF-13796

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes single desktop app instance handling on Windows by moving the single-instance lock acquisition to the beginning of the application startup process. This prevents crashes when launching a second instance and eliminates window flickering issues with jump list elements.

  • Moved single-instance lock and quit logic to the top of the startup file for early termination
  • Introduced a consistent quitApplication function to replace direct app.quit() calls
  • Fixed a minor switch-case issue by replacing return with break in the default clause

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
desktop/src/main/start.ts Restructured app initialization by moving single-instance handling to top and wrapping main logic in runTheApp() function
desktop/src/main/windowsSpecificSetup.ts Fixed switch-case default clause to use break instead of return

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@BykhovDenis BykhovDenis merged commit b09e4dc into develop Sep 27, 2025
15 checks passed
@BykhovDenis BykhovDenis deleted the fix-desktop-app-single-instance-impl branch September 27, 2025 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants