mirror of
https://github.com/swaywm/sway.git
synced 2025-11-25 06:59:48 -05:00
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
This commit is contained in:
parent
6b8bf10941
commit
7c27d73b02
3 changed files with 5 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue