Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Have Quit Menu Item Emit Event] #7586

Closed
RobBotic1 opened this issue Aug 10, 2023 · 2 comments
Closed

[Have Quit Menu Item Emit Event] #7586

RobBotic1 opened this issue Aug 10, 2023 · 2 comments

Comments

@RobBotic1
Copy link

Describe the problem

When my Tauri application exits, I need to perform some cleanup. I've found that I can use WindowEvent::CloseRequested, WindowEvent::Destroyed, or RunEvent::ExitRequested to perform cleanup when the main window is closed. However, if the user selects MenuItem::Quit, the Tauri application exits immediately (exit_app, which simply calls exit(0)).

Given that many users routinely terminate applications with MenuItem::Quit (it is often the norm on Macs, for instance), the lack of any event to allow cleanup results in leaks (e.g., processes that may not be closed and other cleanup needed).

Note that 'Quit' is considered different, semantically, from 'Force Quit.' The current behavior seems more appropriate for a 'Force Quit.'

Describe the solution you'd like

When MenuItem::Quit is selected, RunEvent::ExitRequested should be emitted. If the main window is closed as a result of MenuItem::Quit, the relevant WindowEvents should be emitted (e.g., CloseRequested, Destroyed).

Alternatives considered

No response

Additional context

I noticed a previous bug filed for this issue, but it seems it was deemed not possible at the time.

@RobBotic1
Copy link
Author

In addition to the events, it would be nice if tauri::Builder had a cleanup/on_exit method much like tauri::Builder::setup

@lucasfernog lucasfernog moved this to 📬Proposal in Roadmap Sep 11, 2023
@FabianLars
Copy link
Member

superseeded by #9198

@FabianLars FabianLars closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📬Proposal
Development

No branches or pull requests

2 participants