fix(windows): exit process on WM_ENDSESSION#1157
fix(windows): exit process on WM_ENDSESSION#1157Legend-Master wants to merge 2 commits intotauri-apps:devfrom
WM_ENDSESSION#1157Conversation
Package Changes Through 3363fccThere are 1 changes which include tao with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
After the testing in rust-windowing/winit#4425 (comment), I think it should be possible to exit normally without the |
| // - From Restart Manager: Restart Manager only sends the message but will wait for us to shutdown ourselves | ||
| // | ||
| // So, we call `exit` here directly to align this behavior | ||
| std::process::exit(0); |
There was a problem hiding this comment.
This does also happen in the run_return case? I would really like to not have this then as we want to do some graceful cleanup before exiting.
There was a problem hiding this comment.
This does also happen in the run_return case?
This happens in all cases when you spin the event loop, and yes, including run_return. One thing to note here is no matter what we do here, during shutdown, Windows will terminate us anyways
This does trigger Exit event for you to do some clean ups though
There was a problem hiding this comment.
This does trigger
Exitevent for you to do some clean ups though
I don't quite understand that. If you call process exit here, no more code can execute after this, right?
I don't know the details of WM_ENDSESSION but why can't we just gracefully exit the event-loop here? What would be the point of a signal from Windows if we can't run a few more instructions to shut down?
Exiting the process should IMO be reserved for the binary that embeds Tauri and not happen in Tauri itself.
There was a problem hiding this comment.
I don't quite understand that. If you call process exit here, no more code can execute after this, right?
Yes, the event handler is called in the line above
subclass_input.event_loop_runner.loop_destroyed();
I don't know the details of WM_ENDSESSION but why can't we just gracefully exit the event-loop here? What would be the point of a signal from Windows if we can't run a few more instructions to shut down?
Exiting the process should IMO be reserved for the binary that embeds Tauri and not happen in Tauri itself.
In the Windows shutdown case, you're supposed to block the event loop (not returning from the window procedure) to do the clean up, and once you return, Windows terminates the app if you don't do it yourselves
For the restart manager case, see my comment above #1157 (comment)
Reference: tauri-apps/tauri#14479 (comment)
Open to suggestion on this one, we can detect
lParamhere to do special handling to Restart Manager but I honestly feel like the Windows shutdown behavior itself is a bit of a myth so might just to the exit ourselves regardlesss