mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
wayland/xdg-shell: Add parent window validation in get_popup()
Like in most similar places we can not assume to get a valid window when calling `meta_wayland_surface_get_window` as it e.g. might be unmapped already. Calling `get_popup` on an unmapped window is a client bug, thus post a protocol error when this happens. Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1174 Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1293
This commit is contained in:
parent
59f0aef438
commit
034c6ab9db
@ -1872,6 +1872,15 @@ xdg_surface_constructor_get_popup (struct wl_client *client,
|
||||
return;
|
||||
}
|
||||
|
||||
parent_window = meta_wayland_surface_get_window (parent_surface);
|
||||
if (!parent_window)
|
||||
{
|
||||
wl_resource_post_error (xdg_wm_base_resource,
|
||||
XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT,
|
||||
"Invalid popup parent window");
|
||||
return;
|
||||
}
|
||||
|
||||
xdg_popup = META_WAYLAND_XDG_POPUP (surface->role);
|
||||
|
||||
xdg_popup->resource = wl_resource_create (client,
|
||||
@ -1886,8 +1895,6 @@ xdg_surface_constructor_get_popup (struct wl_client *client,
|
||||
xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_popup);
|
||||
meta_wayland_xdg_surface_constructor_finalize (constructor, xdg_surface);
|
||||
|
||||
parent_window = meta_wayland_surface_get_window (parent_surface);
|
||||
|
||||
xdg_positioner = wl_resource_get_user_data (positioner_resource);
|
||||
xdg_popup->setup.placement_rule =
|
||||
meta_wayland_xdg_positioner_to_placement (xdg_positioner, parent_window);
|
||||
|
Loading…
Reference in New Issue
Block a user