mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
[animation] Do not unref on ::complete by default
Bug 1535 - Complete animation always unrefs ClutterAnimation (even after g_object_ref_sink) Animations created through clutter_animation_new() should not automagically unref themselves by default on ::complete. We only want that behaviour for Animations created by the clutter_actor_animate* family of functions, since those provide the automagic memory management.
This commit is contained in:
parent
bd8d3f6bd8
commit
df738d0a8c
@ -109,6 +109,7 @@ clutter_animation_finalize (GObject *gobject)
|
|||||||
{
|
{
|
||||||
ClutterAnimationPrivate *priv = CLUTTER_ANIMATION (gobject)->priv;
|
ClutterAnimationPrivate *priv = CLUTTER_ANIMATION (gobject)->priv;
|
||||||
|
|
||||||
|
CLUTTER_NOTE (ANIMATION, "Destroying properties hash table");
|
||||||
g_hash_table_destroy (priv->properties);
|
g_hash_table_destroy (priv->properties);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_animation_parent_class)->finalize (gobject);
|
G_OBJECT_CLASS (clutter_animation_parent_class)->finalize (gobject);
|
||||||
@ -237,19 +238,6 @@ clutter_animation_get_property (GObject *gobject,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_animation_real_completed (ClutterAnimation *animation)
|
|
||||||
{
|
|
||||||
CLUTTER_NOTE (ANIMATION, "Animation [%p] complete: unreffing",
|
|
||||||
animation);
|
|
||||||
|
|
||||||
/* the signal emission takes a reference on the animation, which
|
|
||||||
* means that even if we unref it here, it'll be valid for the
|
|
||||||
* whole duration of the emission chain
|
|
||||||
*/
|
|
||||||
g_object_unref (animation);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_animation_class_init (ClutterAnimationClass *klass)
|
clutter_animation_class_init (ClutterAnimationClass *klass)
|
||||||
{
|
{
|
||||||
@ -261,8 +249,6 @@ clutter_animation_class_init (ClutterAnimationClass *klass)
|
|||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (ClutterAnimationPrivate));
|
g_type_class_add_private (klass, sizeof (ClutterAnimationPrivate));
|
||||||
|
|
||||||
klass->completed = clutter_animation_real_completed;
|
|
||||||
|
|
||||||
gobject_class->set_property = clutter_animation_set_property;
|
gobject_class->set_property = clutter_animation_set_property;
|
||||||
gobject_class->get_property = clutter_animation_get_property;
|
gobject_class->get_property = clutter_animation_get_property;
|
||||||
gobject_class->dispose = clutter_animation_dispose;
|
gobject_class->dispose = clutter_animation_dispose;
|
||||||
@ -1232,9 +1218,14 @@ clutter_animation_get_alpha (ClutterAnimation *animation)
|
|||||||
* clutter_animation_completed:
|
* clutter_animation_completed:
|
||||||
* @animation: a #ClutterAnimation
|
* @animation: a #ClutterAnimation
|
||||||
*
|
*
|
||||||
* Emits the ::completed signal on @animation. After this function
|
* Emits the ::completed signal on @animation
|
||||||
* terminates @animation will be unreferenced and it will not be
|
*
|
||||||
* valid anymore, unless g_object_ref() was called before
|
* When using this function with a #ClutterAnimation created
|
||||||
|
* by the clutter_actor_animate() family of functions, @animation
|
||||||
|
* will be unreferenced and it will not be valid anymore,
|
||||||
|
* unless g_object_ref() was called before calling this function
|
||||||
|
* or unless a reference was taken inside a handler for the
|
||||||
|
* #ClutterAnimation::completed signal
|
||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
@ -1246,6 +1237,15 @@ clutter_animation_completed (ClutterAnimation *animation)
|
|||||||
g_signal_emit (animation, animation_signals[COMPLETED], 0);
|
g_signal_emit (animation, animation_signals[COMPLETED], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_animation_completed (ClutterAnimation *animation)
|
||||||
|
{
|
||||||
|
CLUTTER_NOTE (ANIMATION, "Animation[%p] completed, unreferencing",
|
||||||
|
animation);
|
||||||
|
|
||||||
|
g_object_unref (animation);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* starts the timeline
|
* starts the timeline
|
||||||
*/
|
*/
|
||||||
@ -1401,6 +1401,10 @@ clutter_animation_setupv (ClutterAnimation *animation,
|
|||||||
&values[i],
|
&values[i],
|
||||||
pspec);
|
pspec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_signal_connect (animation, "completed",
|
||||||
|
G_CALLBACK (on_animation_completed),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1459,6 +1463,10 @@ clutter_animation_setup_valist (ClutterAnimation *animation,
|
|||||||
|
|
||||||
property_name = va_arg (var_args, gchar*);
|
property_name = va_arg (var_args, gchar*);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_signal_connect (animation, "completed",
|
||||||
|
G_CALLBACK (on_animation_completed),
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1637,9 +1645,9 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
|
|||||||
* to control the animation or to know when the animation has been
|
* to control the animation or to know when the animation has been
|
||||||
* completed.
|
* completed.
|
||||||
*
|
*
|
||||||
* If a name argument starts with "signal::" the two following arguments are
|
* If a name argument starts with "signal::" the two following arguments
|
||||||
* used as callback function and userdata for a signal handler installed on the
|
* are used as callback function and userdata for a signal handler installed
|
||||||
* #ClutterAnimation object, for instance:
|
* on the #ClutterAnimation object, for instance:
|
||||||
*
|
*
|
||||||
* |[
|
* |[
|
||||||
*
|
*
|
||||||
@ -1656,7 +1664,6 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
|
|||||||
* NULL);
|
* NULL);
|
||||||
* ]|
|
* ]|
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Calling this function on an actor that is already being animated
|
* Calling this function on an actor that is already being animated
|
||||||
* will cause the current animation to change with the new final values,
|
* will cause the current animation to change with the new final values,
|
||||||
* the new easing mode and the new duration - that is, this code:
|
* the new easing mode and the new duration - that is, this code:
|
||||||
|
Loading…
Reference in New Issue
Block a user