[mutter] xwayland: Not all xwayland surface have a window
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] xwayland: Not all xwayland surface have a window
- Date: Sun, 23 Feb 2020 17:02:31 +0000 (UTC)
commit b8355a66860027a7265efed9945c2af522b65749
Author: Olivier Fourdan <ofourdan redhat com>
Date: Fri Feb 21 11:57:29 2020 +0100
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
src/wayland/meta-xwayland-surface.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-xwayland-surface.c b/src/wayland/meta-xwayland-surface.c
index 9aef3c27d..3233dcc26 100644
--- a/src/wayland/meta-xwayland-surface.c
+++ b/src/wayland/meta-xwayland-surface.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]