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
This commit is contained in:
Owen W. Taylor 2010-11-11 20:05:35 -05:00
parent c853d197e3
commit 0a4cfde4e2

View File

@ -629,10 +629,16 @@ meta_window_actor_get_shape_bounds (MetaWindowActor *self,
{ {
MetaWindowActorPrivate *priv = self->priv; 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); cairo_region_get_extents (priv->shape_region, bounds);
else else if (priv->bounding_region)
cairo_region_get_extents (priv->bounding_region, bounds); cairo_region_get_extents (priv->bounding_region, bounds);
else
bounds->x = bounds->y = bounds->width = bounds->height = 0;
} }
static void static void
@ -695,6 +701,10 @@ meta_window_actor_get_paint_volume (ClutterActor *actor,
gboolean appears_focused = meta_window_appears_focused (priv->window); gboolean appears_focused = meta_window_appears_focused (priv->window);
ClutterVertex origin; 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); meta_window_actor_get_shape_bounds (self, &bounds);
if (appears_focused ? priv->focused_shadow : priv->unfocused_shadow) if (appears_focused ? priv->focused_shadow : priv->unfocused_shadow)