diff options
author | mwenzkowski <[email protected]> | 2018-12-21 23:25:07 +0100 |
---|---|---|
committer | emersion <[email protected]> | 2019-01-28 16:14:35 +0100 |
commit | 7c27d73b02a1958f323a7c30f46c99414cd6f6bf (patch) | |
tree | 44b7f0cd093a14c776ad4781d41cdc36f5e64efd /sway/desktop/xdg_shell.c | |
parent | 6b8bf10941ec83ac7a6e364b9c34f8c6f74d814a (diff) |
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
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r-- | sway/desktop/xdg_shell.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index b5dcfb0f..152bd26f 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -216,7 +216,7 @@ static bool is_transient_for(struct sway_view *child, return false; } struct wlr_xdg_surface *surface = child->wlr_xdg_surface; - while (surface) { + while (surface && surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) { if (surface->toplevel->parent == ancestor->wlr_xdg_surface) { return true; } |