a11y: Not compute extents for actors without an stage
authorAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 29 Feb 2012 14:49:23 +0000 (15:49 +0100)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 29 Feb 2012 14:52:49 +0000 (15:52 +0100)
This solves a crash on GNOME Shell, as compute the extents
for some StWidgets could lead to call st_widget_get_theme_node,
and it is a fatal error to call this on a widget that it not
beed added to a stage.

clutter/cally/cally-actor.c

index 72babdb..81c94bc 100644 (file)
@@ -668,6 +668,7 @@ cally_actor_get_extents (AtkComponent *component,
   gint          top_level_x, top_level_y;
   gfloat        f_width, f_height;
   ClutterVertex verts[4];
+  ClutterActor  *stage = NULL;
 
   g_return_if_fail (CALLY_IS_ACTOR (component));
 
@@ -677,6 +678,12 @@ cally_actor_get_extents (AtkComponent *component,
   if (actor == NULL) /* actor is defunct */
     return;
 
+  /* If the actor is not placed in any stage, we can't compute the
+   * extents */
+  stage = clutter_actor_get_stage (actor);
+  if (stage == NULL)
+    return;
+
   clutter_actor_get_abs_allocation_vertices (actor, verts);
   clutter_actor_get_transformed_size (actor, &f_width, &f_height);