diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c index c5d177b2..6931b92f 100644 --- a/types/xdg_shell/wlr_xdg_surface.c +++ b/types/xdg_shell/wlr_xdg_surface.c @@ -415,6 +415,12 @@ void destroy_xdg_surface(struct wlr_xdg_surface *surface) { wlr_signal_emit_safe(&surface->events.destroy, surface); + struct wlr_xdg_popup *popup_state, *next; + wl_list_for_each_safe(popup_state, next, &surface->popups, link) { + xdg_popup_send_popup_done(popup_state->resource); + destroy_xdg_popup(popup_state->base); + } + switch (surface->role) { case WLR_XDG_SURFACE_ROLE_TOPLEVEL: destroy_xdg_toplevel(surface); diff --git a/types/xdg_shell_v6/wlr_xdg_surface_v6.c b/types/xdg_shell_v6/wlr_xdg_surface_v6.c index e111adad..7343906f 100644 --- a/types/xdg_shell_v6/wlr_xdg_surface_v6.c +++ b/types/xdg_shell_v6/wlr_xdg_surface_v6.c @@ -100,6 +100,12 @@ void destroy_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface) { wlr_signal_emit_safe(&surface->events.destroy, surface); + struct wlr_xdg_popup_v6 *popup_state, *next; + wl_list_for_each_safe(popup_state, next, &surface->popups, link) { + zxdg_popup_v6_send_popup_done(popup_state->resource); + destroy_xdg_popup_v6(popup_state->base); + } + switch (surface->role) { case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL: destroy_xdg_toplevel_v6(surface);