aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor E <38229097+c-edw@users.noreply.github.com>2019-02-01 10:59:47 +0000
committeremersion <contact@emersion.fr>2019-02-04 10:43:51 +0100
commitc1d0729d9a7bb3d4314e400f7131746ebd646de9 (patch)
tree62fe9ecb138f7c88a3c043ffcbea90dd2d20633f
parent841b4fd9182f95f8ad14a7eda1c98d23122b8747 (diff)
Make popup inert when destroyed.
-rw-r--r--types/xdg_shell/wlr_xdg_popup.c3
-rw-r--r--types/xdg_shell/wlr_xdg_surface.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c
index 598c14ef..b27a629e 100644
--- a/types/xdg_shell/wlr_xdg_popup.c
+++ b/types/xdg_shell/wlr_xdg_popup.c
@@ -285,7 +285,8 @@ void destroy_xdg_popup(struct wlr_xdg_surface *xdg_surface) {
if (xdg_surface == NULL) {
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);
}
diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c
index 0e98155a..db3fc29a 100644
--- a/types/xdg_shell/wlr_xdg_surface.c
+++ b/types/xdg_shell/wlr_xdg_surface.c
@@ -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) {
+ if (surface == NULL) {
+ return;
+ }
assert(surface->popup);
assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
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,