summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdel Gadllah <adel.gadllah@gmail.com>2010-11-21 19:57:42 +0100
committerAdel Gadllah <adel.gadllah@gmail.com>2010-11-21 19:57:42 +0100
commit1394c566ebfac3ea41ee2f70b57279a58921ea23 (patch)
tree83bad74d46da27acfc1560976f0bb702edb444f3
parent3183d954a08bce198cc06bd8430365c253255253 (diff)
downloadmutter-1394c566ebfac3ea41ee2f70b57279a58921ea23.tar.gz
[MetaWindowActor] Fix crash in shadow shape creation
Protect against shape_region or bounding_region being NULL in check_needs_shadow. This can happen for short lived windows and result into a crash. https://bugzilla.gnome.org/show_bug.cgi?id=635421
-rw-r--r--src/compositor/meta-window-actor.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index c737d6d61..573ce2db0 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1887,24 +1887,26 @@ check_needs_shadow (MetaWindowActor *self)
if (*shadow_location == NULL && should_have_shadow)
{
- MetaShadowFactory *factory = meta_shadow_factory_get_default ();
- const char *shadow_class = meta_window_actor_get_shadow_class (self);
- cairo_rectangle_int_t shape_bounds;
-
if (priv->shadow_shape == NULL)
{
- if (priv->shaped)
+ if (priv->shaped && priv->shape_region)
priv->shadow_shape = meta_window_shape_new (priv->shape_region);
- else
+ else if (priv->bounding_region)
priv->shadow_shape = meta_window_shape_new (priv->bounding_region);
}
- meta_window_actor_get_shape_bounds (self, &shape_bounds);
-
- *shadow_location = meta_shadow_factory_get_shadow (factory,
- priv->shadow_shape,
- shape_bounds.width, shape_bounds.height,
- shadow_class, appears_focused);
+ if (priv->shadow_shape != NULL)
+ {
+ MetaShadowFactory *factory = meta_shadow_factory_get_default ();
+ const char *shadow_class = meta_window_actor_get_shadow_class (self);
+ cairo_rectangle_int_t shape_bounds;
+
+ meta_window_actor_get_shape_bounds (self, &shape_bounds);
+ *shadow_location = meta_shadow_factory_get_shadow (factory,
+ priv->shadow_shape,
+ shape_bounds.width, shape_bounds.height,
+ shadow_class, appears_focused);
+ }
}
if (old_shadow != NULL)