From 0a4cfde4e2d83d9044fb0368597e92321b402566 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Thu, 11 Nov 2010 20:05:35 -0500 Subject: MetaWindowActor: Fix crashes when mapping and unmapping windows The assumptions made when getting the size of the window for the paint volume turned out not to be accurate in all cases - get_paint_volume() could be called on windows without computed bounds. https://bugzilla.gnome.org/show_bug.cgi?id=592382 --- src/compositor/meta-window-actor.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index e57516223..3ed16eb1a 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -629,10 +629,16 @@ meta_window_actor_get_shape_bounds (MetaWindowActor *self, { MetaWindowActorPrivate *priv = self->priv; - if (priv->shaped) + /* We need to be defensive here because there are corner cases + * where getting the shape fails on a window being destroyed + * and similar. + */ + if (priv->shaped && priv->shape_region) cairo_region_get_extents (priv->shape_region, bounds); - else + else if (priv->bounding_region) cairo_region_get_extents (priv->bounding_region, bounds); + else + bounds->x = bounds->y = bounds->width = bounds->height = 0; } static void @@ -695,6 +701,10 @@ meta_window_actor_get_paint_volume (ClutterActor *actor, gboolean appears_focused = meta_window_appears_focused (priv->window); ClutterVertex origin; + /* The paint volume is computed before paint functions are called + * so our bounds might not be updated yet. Force an update. */ + meta_window_actor_pre_paint (self); + meta_window_actor_get_shape_bounds (self, &bounds); if (appears_focused ? priv->focused_shadow : priv->unfocused_shadow) -- cgit v1.2.1