mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
box-layout: Plug a memory leak
Similar to commit 4724be167f
for
TableLayout.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2358
This commit is contained in:
parent
4724be167f
commit
981fed1f63
@ -114,15 +114,12 @@ struct _ClutterBoxChild
|
||||
ClutterBoxAlignment x_align;
|
||||
ClutterBoxAlignment y_align;
|
||||
|
||||
ClutterActorBox last_allocation;
|
||||
|
||||
guint x_fill : 1;
|
||||
guint y_fill : 1;
|
||||
|
||||
guint expand : 1;
|
||||
|
||||
/* the last stable allocation before an animation; it is
|
||||
* used as the initial ActorBox when interpolating
|
||||
*/
|
||||
ClutterActorBox *last_allocation;
|
||||
guint has_last_allocation : 1;
|
||||
};
|
||||
|
||||
enum
|
||||
@ -360,16 +357,6 @@ clutter_box_child_get_property (GObject *gobject,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_box_child_finalize (GObject *gobject)
|
||||
{
|
||||
ClutterBoxChild *self = CLUTTER_BOX_CHILD (gobject);
|
||||
|
||||
clutter_actor_box_free (self->last_allocation);
|
||||
|
||||
G_OBJECT_CLASS (clutter_box_child_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_box_child_class_init (ClutterBoxChildClass *klass)
|
||||
{
|
||||
@ -378,7 +365,6 @@ clutter_box_child_class_init (ClutterBoxChildClass *klass)
|
||||
|
||||
gobject_class->set_property = clutter_box_child_set_property;
|
||||
gobject_class->get_property = clutter_box_child_get_property;
|
||||
gobject_class->finalize = clutter_box_child_finalize;
|
||||
|
||||
pspec = g_param_spec_boolean ("expand",
|
||||
P_("Expand"),
|
||||
@ -434,7 +420,7 @@ clutter_box_child_init (ClutterBoxChild *self)
|
||||
|
||||
self->expand = FALSE;
|
||||
|
||||
self->last_allocation = NULL;
|
||||
self->has_last_allocation = FALSE;
|
||||
}
|
||||
|
||||
static gdouble
|
||||
@ -719,24 +705,24 @@ allocate_box_child (ClutterBoxLayout *self,
|
||||
if (priv->use_animations && priv->is_animating)
|
||||
{
|
||||
ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (self);
|
||||
ClutterActorBox *start = NULL;
|
||||
ClutterActorBox end = { 0, };
|
||||
ClutterActorBox *start, end;
|
||||
gdouble p;
|
||||
|
||||
p = clutter_layout_manager_get_animation_progress (manager);
|
||||
|
||||
start = box_child->last_allocation;
|
||||
if (start == NULL)
|
||||
if (!box_child->has_last_allocation)
|
||||
{
|
||||
/* if there is no allocation available then the child has just
|
||||
* been added to the container; we put it in the final state
|
||||
* and store its allocation for later
|
||||
*/
|
||||
box_child->last_allocation = clutter_actor_box_copy (&child_box);
|
||||
box_child->last_allocation = child_box;
|
||||
box_child->has_last_allocation = TRUE;
|
||||
|
||||
goto do_allocate;
|
||||
}
|
||||
|
||||
start = &box_child->last_allocation;
|
||||
end = child_box;
|
||||
|
||||
/* interpolate between the initial and final values */
|
||||
@ -757,7 +743,8 @@ allocate_box_child (ClutterBoxLayout *self,
|
||||
else
|
||||
{
|
||||
/* store the allocation for later animations */
|
||||
box_child->last_allocation = clutter_actor_box_copy (&child_box);
|
||||
box_child->last_allocation = child_box;
|
||||
box_child->has_last_allocation = TRUE;
|
||||
}
|
||||
|
||||
do_allocate:
|
||||
|
Loading…
Reference in New Issue
Block a user