mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-07 15:31:30 +02:00
[client] Keep tray quit state across an aborted Windows session end
An aborted session end (WM_ENDSESSION with wParam == 0) cleared the shared shutdown flag, re-enabling hide-on-close cancels and dialogs while a tray quit was still tearing down. Track the session-end and tray-quit sources as separate flags; aborting a session end only clears its own state.
This commit is contained in:
@@ -2,16 +2,23 @@ package services
|
||||
|
||||
import "sync/atomic"
|
||||
|
||||
var shuttingDown atomic.Bool
|
||||
var (
|
||||
sessionEnding atomic.Bool
|
||||
quitting atomic.Bool
|
||||
)
|
||||
|
||||
func BeginShutdown() {
|
||||
shuttingDown.Store(true)
|
||||
func BeginSessionEnd() {
|
||||
sessionEnding.Store(true)
|
||||
}
|
||||
|
||||
func AbortShutdown() {
|
||||
shuttingDown.Store(false)
|
||||
func AbortSessionEnd() {
|
||||
sessionEnding.Store(false)
|
||||
}
|
||||
|
||||
func BeginShutdown() {
|
||||
quitting.Store(true)
|
||||
}
|
||||
|
||||
func ShuttingDown() bool {
|
||||
return shuttingDown.Load()
|
||||
return sessionEnding.Load() || quitting.Load()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user