wails icon indicating copy to clipboard operation
wails copied to clipboard

Windows: execute `OnShutdown` on `WM_ENDSESSION`

Open anfragment opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

On Windows, Wails's primary WndProc doesn't handle WM_ENDSESSION nor WM_QUERYENDSESSION, which results in OnShutdown not executing on system shutdown. A concrete example of where this is not the desirable behavior is a system proxy application. During shutdown, such an application might disable traffic proxying which it set up during runtime. If proxying is not turned off during system shutdown, after being turned back on the system will experience network connectivity issues until the application is reenabled or the user disables proxying manually.

Describe the solution you'd like

Wails executes OnShutdown after receiving WM_ENDESSION. Optionally, it might also listen for WM_QUERYENDSESSION and prevent shutdown by returning false if OnBeforeClose returns true.

Describe alternatives you've considered

No response

Additional context

No response

anfragment avatar Nov 20 '24 22:11 anfragment