mirror of
https://github.com/brl/mutter.git
synced 2025-02-09 01:54:10 +00:00
[animation] Do not leak timelines
The timeline created when calling set_timeline(NULL) is referenced even though we implicitly own it. When the Animation is destroyed, the timeline is then leaked. Thanks to: Richard Heatley <richard.heatley@starleaf.com> Fixes bug: http://bugzilla.openedhand.com/show_bug.cgi?id=1548
This commit is contained in:
parent
21e3901d62
commit
2f5012e38c
@ -1115,12 +1115,12 @@ clutter_animation_set_timeline (ClutterAnimation *animation,
|
|||||||
|
|
||||||
priv = animation->priv;
|
priv = animation->priv;
|
||||||
|
|
||||||
if (timeline && priv->timeline == timeline)
|
if (timeline != NULL && priv->timeline == timeline)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (animation));
|
g_object_freeze_notify (G_OBJECT (animation));
|
||||||
|
|
||||||
if (priv->timeline)
|
if (priv->timeline != NULL)
|
||||||
{
|
{
|
||||||
if (priv->timeline_started_id)
|
if (priv->timeline_started_id)
|
||||||
g_signal_handler_disconnect (priv->timeline,
|
g_signal_handler_disconnect (priv->timeline,
|
||||||
@ -1136,13 +1136,17 @@ clutter_animation_set_timeline (ClutterAnimation *animation,
|
|||||||
priv->timeline = 0;
|
priv->timeline = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!timeline)
|
if (timeline == NULL)
|
||||||
timeline = g_object_new (CLUTTER_TYPE_TIMELINE,
|
{
|
||||||
"duration", priv->duration,
|
timeline = g_object_new (CLUTTER_TYPE_TIMELINE,
|
||||||
"loop", priv->loop,
|
"duration", priv->duration,
|
||||||
NULL);
|
"loop", priv->loop,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
g_object_ref (timeline);
|
||||||
|
|
||||||
priv->duration = clutter_timeline_get_duration (timeline);
|
priv->duration = clutter_timeline_get_duration (timeline);
|
||||||
g_object_notify (G_OBJECT (animation), "duration");
|
g_object_notify (G_OBJECT (animation), "duration");
|
||||||
|
|
||||||
@ -1150,7 +1154,7 @@ clutter_animation_set_timeline (ClutterAnimation *animation,
|
|||||||
g_object_notify (G_OBJECT (animation), "loop");
|
g_object_notify (G_OBJECT (animation), "loop");
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->timeline = g_object_ref (timeline);
|
priv->timeline = timeline;
|
||||||
g_object_notify (G_OBJECT (animation), "timeline");
|
g_object_notify (G_OBJECT (animation), "timeline");
|
||||||
|
|
||||||
priv->timeline_started_id =
|
priv->timeline_started_id =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user