-
Notifications
You must be signed in to change notification settings - Fork 569
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
ui.run()
doesn't return on macOS when pressing Cmd+Q and using winit
#4482
Comments
Yes indeed, this seems to be the case. winit calls terminate, which has this bit in its documentation:
I'm not sure there's that much that we can do, but one thing we should do is invoke the close request on the window. I'll check if that happens, then you can catch that at least. |
Ah, we can't catch that, it's not a request after all. winit sends LoopExiting and Destroyed per window, but we don't have hooks for that. |
For Android this was solved using dedicated API (#3430), but we may want to have a cross-platform solution in the long run that eliminates the need for main(). |
The best workaround I can think of right now would be to offer API to invoke a callback when the event loop is about to quit. This doesn't really fit well into the current (global) API, but it would be a natural fit for #4294. |
I gave some more thought to this issue and it is extremely important to have a graceful termination path. I'm thinking to have an embedded database within my application and it would be super problematic if the database can't shutdown nicely and ends up in a corrupted state because of a Worst case scenario I could run it in a child process, but I hope I don't have to. |
I've thought about this again and despite my comment I'm starting to think that perhaps the out of the box experience should result in the event loop terminating gracefully (so that destructors are called). We can implement that in Slint (let's use this issue). |
ui.run()
doesn't return on macOS when pressing Cmd+Q and using winit.Is this a bug? I believe that Cmd+Q is a common way to quit an application and should just make ui.run() return.
I have cleanup logic that needs to run after ui.run().
Thanks,
Alex
The text was updated successfully, but these errors were encountered: