Skip to content

fix: properly exit app when window is closed - #777

Merged
loathingKernel merged 5 commits into
RareDevs:mainfrom
alessio-attilio:fix/close-app-exit
Aug 17, 2026
Merged

fix: properly exit app when window is closed#777
loathingKernel merged 5 commits into
RareDevs:mainfrom
alessio-attilio:fix/close-app-exit

Conversation

@alessio-attilio

Copy link
Copy Markdown
Contributor

Fixes the app not exiting for real when the window is closed. Ctrl+C now triggers a clean shutdown instead of a KeyboardInterrupt traceback that PySide6 swallows, and shutdown can no longer hang indefinitely on background workers. Confirming the queue-clear prompt now proceeds with the close instead of ignoring it.

@loathingKernel

loathingKernel commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

I will have to think about this and its side-effects, I am not so sure I want to exit background workers forcibly. Sadly there is no good way to exit them cleanly without re-implementing them or changing how they work in Legendary. And then there is the matter of making sure that Rare doesn't update any important information in the metadata at the start of the worker, but rather do it at the end. This is not as a simple change, even I do understand why it is desirable.

@alessio-attilio

Copy link
Copy Markdown
Contributor Author

Personal opinion: it’s better to do this; ensuring the app closes properly than to have an exception or, even worse, an app running in the background when it isn’t needed.

@loathingKernel

Copy link
Copy Markdown
Contributor

an app running in the background when it isn’t needed.

The application won't run in the background when it's not needed. I agree with handling the SIGINT and SIGTERM is a good idea, but maybe they should be ignored instead if there are active workers.

Comment thread rare/components/__init__.py Outdated
@alessio-attilio

alessio-attilio commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

The application won't run in the background when it's not needed. I agree with handling the SIGINT and SIGTERM is a good idea, but maybe they should be ignored instead if there are active workers.

At the moment, even if I close it, it keeps running in the background; I always have to force it to close, even from the system tray.

At least that way I can close it from the CLI, without having to worry about all sorts of exceptions

@loathingKernel

Copy link
Copy Markdown
Contributor

At the moment, even if I close it, it keeps running in the background; I always have to force it to close, even from the system tray.

I do not have that behavior, but there is a chance that I expect the behavior and don't notice it, can you run from a terminal and see what it is doing and doesn't exit?

@alessio-attilio

Copy link
Copy Markdown
Contributor Author

Sorry, ‘force push’ was because I’d entered the wrong email address

@alessio-attilio

Copy link
Copy Markdown
Contributor Author

I do not have that behavior, but there is a chance that I expect the behavior and don't notice it, can you run from a terminal and see what it is doing and doesn't exit?

When I close it, it disconnects from the terminal but remains open (I can see this in Task Manager; "rare" process is still running)

@loathingKernel

loathingKernel commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

When I close it, it disconnects from the terminal but remains open (I can see this in Task Manager; "rare" process is still running)

This doesn't have anything to do with the active worker threads, this is just our exception handler. When you send SIGINT, as you said it gets caught as an KeyboardInterrupt exception, and the exception handler is presented. Arguably this should be handled better, or trigger the interactive shutdown procedure, but it's not immediately related to the worker threads, rather the application keeps on running almost normally depending on your selection in the exception handler.

Comment thread rare/components/__init__.py Outdated
Comment thread rare/components/main_window.py Outdated
@loathingKernel
loathingKernel merged commit 3faf044 into RareDevs:main Aug 17, 2026
17 checks passed
@loathingKernel

Copy link
Copy Markdown
Contributor

Thanks, this looks proper now, I went ahead and merged it.

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.

2 participants