From 7c27d73b02a1958f323a7c30f46c99414cd6f6bf Mon Sep 17 00:00:00 2001 From: mwenzkowski <29407878+mwenzkowski@users.noreply.github.com> Date: Fri, 21 Dec 2018 23:25:07 +0100 Subject: Check xdg_surface's role before using its toplevel Don't access xdg_surface->toplevel if xdg_surface->role is equal to WLR_XDG_SURFACE_ROLE_NONE, since this could lead to crash. The same checks are added for xdg_surface_v6. Fixes #3311 --- sway/desktop/xdg_shell_v6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sway/desktop/xdg_shell_v6.c') diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index a7ea163f..3eed54ab 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -213,7 +213,7 @@ static bool is_transient_for(struct sway_view *child, return false; } struct wlr_xdg_surface_v6 *surface = child->wlr_xdg_surface_v6; - while (surface) { + while (surface && surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) { if (surface->toplevel->parent == ancestor->wlr_xdg_surface_v6) { return true; } -- cgit v1.2.3