grid-layout: Don't use uninitialized values

The clutter_actor_box_set_* methods rely on the current box
geometry, so we can't use those for an uninitialize actor box.
Found by Coverity.

https://bugzilla.gnome.org/show_bug.cgi?id=689496
This commit is contained in:
Jasper St. Pierre 2012-11-30 21:07:49 -05:00
parent 5aca3c4992
commit 039ba910f0

View File

@ -1425,13 +1425,16 @@ clutter_grid_layout_allocate (ClutterLayoutManager *layout,
&y, &height); &y, &height);
x += allocation->x1; x += allocation->x1;
y += allocation->y1; y += allocation->y1;
clutter_actor_box_set_origin (&child_allocation, x, y);
clutter_actor_box_set_size (&child_allocation, width, height);
CLUTTER_NOTE (LAYOUT, "Allocation for %s { %.2f, %.2f - %.2f x %.2f }", CLUTTER_NOTE (LAYOUT, "Allocation for %s { %.2f, %.2f - %.2f x %.2f }",
_clutter_actor_get_debug_name (child), _clutter_actor_get_debug_name (child),
x, y, width, height); x, y, width, height);
child_allocation.x1 = x;
child_allocation.y1 = y;
child_allocation.x2 = child_allocation.x1 + width;
child_allocation.y2 = child_allocation.y1 + height;
clutter_actor_allocate (child, &child_allocation, flags); clutter_actor_allocate (child, &child_allocation, flags);
} }
} }