aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Bozhinov <ammen99@gmail.com>2020-10-27 18:28:39 +0100
committerSimon Ser <contact@emersion.fr>2020-11-08 14:26:03 +0100
commit9595f95452a1d7420bbb190dc29c3806c29ca41e (patch)
treee4e39046dc3d9c7c6cec0ff30952142098398fac
parent372a52ecc08aff003b3024e852e848024b699a15 (diff)
xdg_shell: handle inert popups
xdg_popups can be destroyed by the compositor when closed. When this happens, wlroots makes the xdg_popup surface inert and resets the xdg_surface role to NONE. Currently, wlroots sends a protocol error and asserts that an xdg_surface has a role when committed. This is racy if at the same time the client commits an xdg_popup and the compositor closes it. This patch removes the assertion and ignores commits on xdg_surfaces without a role set.
-rw-r--r--types/xdg_shell/wlr_xdg_surface.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c
index d33cbffe..b65490d0 100644
--- a/types/xdg_shell/wlr_xdg_surface.c
+++ b/types/xdg_shell/wlr_xdg_surface.c
@@ -336,7 +336,9 @@ static void xdg_surface_handle_surface_commit(struct wl_listener *listener,
return;
}
- if (surface->role == WLR_XDG_SURFACE_ROLE_NONE) {
+ // surface->role might be NONE for inert popups
+ // So we check surface->surface->role
+ if (surface->surface->role == NULL) {
wl_resource_post_error(surface->resource,
XDG_SURFACE_ERROR_NOT_CONSTRUCTED,
"xdg_surface must have a role");
@@ -361,7 +363,8 @@ void handle_xdg_surface_commit(struct wlr_surface *wlr_surface) {
switch (surface->role) {
case WLR_XDG_SURFACE_ROLE_NONE:
- assert(false);
+ // inert toplevel or popup
+ return;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
handle_xdg_surface_toplevel_committed(surface);
break;