summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2015-09-08 11:52:10 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2015-09-09 09:30:14 +0200
commit443d579d402d82ae6b178036266f46576f9e2fbc (patch)
tree9ea36e819c8989daad4a2f9db158cc5f8bb96f44
parent5066eaf691cbd34a05d9204ddcbf10d9ee537bcc (diff)
downloadmutter-443d579d402d82ae6b178036266f46576f9e2fbc.tar.gz
wayland: do not crash if the surface is gone
If a queued event is being processed after the surface is destroyed, trying to access the window associated with the surface will lead to a segmentation fault. This patch avoids the crash by first checking if the surface is not null. https://bugzilla.gnome.org/show_bug.cgi?id=754715
-rw-r--r--src/compositor/meta-surface-actor-wayland.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index d89f6dcd3..4e3ae8d6e 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -293,8 +293,12 @@ static MetaWindow *
meta_surface_actor_wayland_get_window (MetaSurfaceActor *actor)
{
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (META_SURFACE_ACTOR_WAYLAND (actor));
+ MetaWaylandSurface *surface = priv->surface;
- return priv->surface->window;
+ if (!surface)
+ return NULL;
+
+ return surface->window;
}
static void