From dbe919ef922368d952ff3f21db411d0160d4c42b Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Mon, 30 Mar 2020 15:53:29 +0200 Subject: [PATCH] wayland/surface: Check for surface role in meta_wayland_surface_get_window() The function can get called without valid surface role, e.g. from `zwp_xwayland_keyboard_grab_manager_grab()`. Debugged by @piegamesde Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1147 --- src/wayland/meta-wayland-surface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index f7cdb0171..7e5e8eb71 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1745,6 +1745,9 @@ meta_wayland_surface_role_get_window (MetaWaylandSurfaceRole *surface_role) MetaWindow * meta_wayland_surface_get_window (MetaWaylandSurface *surface) { + if (!surface->role) + return NULL; + return meta_wayland_surface_role_get_window (surface->role); }