From 8daff13af6cdbe4cb689e324f6ba343062dad050 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 25 Oct 2024 22:05:24 +0200 Subject: [PATCH] app: [windows] ensure no callbacks after DestroyEvent Setting the callback handler to nil in DestroyEvent should have no effect, but may help debugging #603. Also don't call the default window handler for WM_DESTROY since we're already handling it. References: https://todo.sr.ht/~eliasnaur/gio/603 Signed-off-by: Elias Naur --- app/os_windows.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/os_windows.go b/app/os_windows.go index 1dbc067c..5b18d8f2 100644 --- a/app/os_windows.go +++ b/app/os_windows.go @@ -314,6 +314,7 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr case windows.WM_DESTROY: w.ProcessEvent(Win32ViewEvent{}) w.ProcessEvent(DestroyEvent{}) + w.w = nil if w.hdc != 0 { windows.ReleaseDC(w.hdc) w.hdc = 0 @@ -321,6 +322,7 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr // The system destroys the HWND for us. w.hwnd = 0 windows.PostQuitMessage(0) + return 0 case windows.WM_NCCALCSIZE: if w.config.Decorated { // Let Windows handle decorations.