[mutter/configurable-shadows] MetaWindowActor: Fix crashes when mapping and unmapping windows



commit f89fd89a9d205ce96121ddbb2eac6684d034b2fe
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Nov 11 20:05:35 2010 -0500

    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 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 0f3da65..4b6251a 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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]