mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
xwayland: Not all xwayland surface have a window
`meta_xwayland_surface_get_relative_coordinates()` may cause a crash if the Xwayland surface has no window associated. That can be observed when using drag and drop from an X11 window to a Wayland native window: ``` at src/core/window.c:4503 at src/wayland/meta-xwayland-surface.c:200 at src/wayland/meta-wayland-surface.c:1517 at src/wayland/meta-wayland-pointer.c:1048 at src/wayland/meta-wayland-pointer.c:840 at src/wayland/meta-wayland-pointer.c:865 at src/wayland/meta-wayland-pointer.c:954 at src/wayland/meta-wayland-pointer.c:456 at src/wayland/meta-wayland-pointer.c:993 at src/wayland/meta-wayland-data-device.c:1004 at src/wayland/meta-wayland-data-device.c:1278 at src/wayland/meta-xwayland-dnd.c:326 ``` Check if the xwayland surface has an associated MetaWindow prior to get its buffer rect. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1073
This commit is contained in:
parent
4c421959dc
commit
b8355a6686
@ -195,9 +195,11 @@ meta_xwayland_surface_get_relative_coordinates (MetaWaylandSurfaceRole *surface_
|
||||
float *out_sy)
|
||||
{
|
||||
MetaXwaylandSurface *xwayland_surface = META_XWAYLAND_SURFACE (surface_role);
|
||||
MetaRectangle window_rect;
|
||||
MetaRectangle window_rect = { 0 };
|
||||
|
||||
if (xwayland_surface->window)
|
||||
meta_window_get_buffer_rect (xwayland_surface->window, &window_rect);
|
||||
|
||||
meta_window_get_buffer_rect (xwayland_surface->window, &window_rect);
|
||||
*out_sx = abs_x - window_rect.x;
|
||||
*out_sy = abs_y - window_rect.y;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user