From 042ed4ab49274fa23a7196008204143444f9a7fe Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 30 Jul 2024 13:49:31 +0200 Subject: [PATCH] app: [Windows] don't draw after WM_DESTROY destroyed the window There may be a window of time from WM_DESTROY is received to the WM_QUIT message is delivered by PostQuitMessage. If so, we must not call w.draw. Fixes: https://todo.sr.ht/~eliasnaur/gio/603 Signed-off-by: Elias Naur --- app/os_windows.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/os_windows.go b/app/os_windows.go index a20f4960..fdb4a860 100644 --- a/app/os_windows.go +++ b/app/os_windows.go @@ -558,8 +558,7 @@ func (w *window) runLoop() { msg := new(windows.Msg) loop: for { - anim := w.animating - if anim && !windows.PeekMessage(msg, 0, 0, 0, windows.PM_NOREMOVE) { + if w.hwnd != 0 && w.animating && !windows.PeekMessage(msg, 0, 0, 0, windows.PM_NOREMOVE) { w.draw(false) continue }