a11y: Not compute extents for actors without an stage

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.
This commit is contained in:
Alejandro Piñeiro 2012-02-29 15:49:23 +01:00
parent dde5da1dd8
commit 6e78ebca95

View 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);