dc62058bcefc51bd138d12668bba5a11dfed3e3f — Elias Naur 2 months ago 5766a8d
ui/app: (wayland) ensure DestroyEvent is the last event

A ToplevelClose event could end in the same batch of events as
another event, which will result in the other event being sent
after a DestroyEvent. Window assumes no event will arrive after
DestroyEvent, so ensure that property for the Wayland backend.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
1 files changed, 1 insertions(+), 1 deletions(-)

M ui/app/os_wayland.go
M ui/app/os_wayland.go => ui/app/os_wayland.go +1 -1
@@ 310,7 310,6 @@ func gio_onXdgSurfaceConfigure(data unsafe.Pointer, wmSurf *C.struct_xdg_surface
 func gio_onToplevelClose(data unsafe.Pointer, topLvl *C.struct_xdg_toplevel) {
 	w := winMap[topLvl]
 	w.dead = true
-	w.w.event(DestroyEvent{})
 }
 
 //export gio_onToplevelConfigure


@@ 772,6 771,7 @@ loop:
 			break
 		}
 		if w.dead {
+			w.w.event(DestroyEvent{})
 			break
 		}
 		// Clear poll events.