fix crash: validate last_hovered_view before LEAVE event

When a dialog is closed, its views are freed but last_hovered_view
may still point to them. Use W_IsValidView() guard before accessing
the stale pointer.
This commit is contained in:
lkn 2026-06-23 23:43:32 +02:00
parent 6d3de364f5
commit 1e4d36143e
1 changed files with 3 additions and 1 deletions

View File

@ -117,10 +117,12 @@ handle_pointer_motion(struct wl_listener *listener, void *data)
}
W_WL_EnqueueEvent(wmscr, &wev, mtarget);
/* Synthesize ENTER/LEAVE for WINGs child view transitions. */
extern Bool W_IsValidView(W_View *view);
if (mtarget != wl_state.last_hovered_view) {
WMEvent cev;
memset(&cev, 0, sizeof(cev));
if (wl_state.last_hovered_view) {
if (wl_state.last_hovered_view
&& W_IsValidView(wl_state.last_hovered_view)) {
cev.type = WME_LEAVE;
cev.window = wl_state.last_hovered_view->window;
cev.u.crossing.window = cev.window;