Make popup inert when destroyed.

This commit is contained in:
Connor E 2019-02-01 10:59:47 +00:00 committed by emersion
parent 841b4fd918
commit c1d0729d9a
2 changed files with 7 additions and 1 deletions

View File

@ -285,7 +285,8 @@ void destroy_xdg_popup(struct wlr_xdg_surface *xdg_surface) {
if (xdg_surface == NULL) { if (xdg_surface == NULL) {
return; return;
} }
assert(xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP); assert(xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP ||
xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE);
reset_xdg_surface(xdg_surface); reset_xdg_surface(xdg_surface);
} }

View File

@ -524,9 +524,14 @@ void wlr_xdg_toplevel_send_close(struct wlr_xdg_surface *surface) {
} }
void wlr_xdg_popup_destroy(struct wlr_xdg_surface *surface) { void wlr_xdg_popup_destroy(struct wlr_xdg_surface *surface) {
if (surface == NULL) {
return;
}
assert(surface->popup); assert(surface->popup);
assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP); assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
xdg_popup_send_popup_done(surface->popup->resource); xdg_popup_send_popup_done(surface->popup->resource);
wl_resource_set_user_data(surface->popup->resource, NULL);
destroy_xdg_popup(surface);
} }
static void xdg_popup_get_position(struct wlr_xdg_popup *popup, static void xdg_popup_get_position(struct wlr_xdg_popup *popup,