From ff73fe3e1f142517617cddf6c73c72783bb7fe92 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 5 Jan 2009 13:14:12 +0000 Subject: [PATCH] Fix some animation_set_* functions so they cope if the value is the same The following functions are fixed: clutter_animation_set_actor clutter_animation_set_timeline clutter_animation_set_alpha This is related to bug 1392 which discusses the problem for behaviour_set_alpha. --- clutter/clutter-animation.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/clutter/clutter-animation.c b/clutter/clutter-animation.c index 4dc1aed..eae8125 100644 --- a/clutter/clutter-animation.c +++ b/clutter/clutter-animation.c @@ -739,6 +739,8 @@ clutter_animation_set_actor (ClutterAnimation *animation, priv = animation->priv; + g_object_ref (actor); + if (priv->actor) { g_object_weak_unref (G_OBJECT (animation), @@ -750,7 +752,7 @@ clutter_animation_set_actor (ClutterAnimation *animation, g_object_unref (priv->actor); } - priv->actor = g_object_ref (actor); + priv->actor = actor; g_object_weak_ref (G_OBJECT (animation), on_animation_weak_notify, priv->actor); @@ -967,6 +969,9 @@ clutter_animation_set_timeline (ClutterAnimation *animation, priv = animation->priv; + if (timeline && priv->timeline == timeline) + return; + g_object_freeze_notify (G_OBJECT (animation)); if (priv->timeline) @@ -1047,16 +1052,6 @@ clutter_animation_set_alpha (ClutterAnimation *animation, priv = animation->priv; - if (priv->alpha) - { - if (priv->alpha_notify_id) - g_signal_handler_disconnect (priv->alpha, priv->alpha_notify_id); - - g_object_unref (priv->alpha); - priv->alpha_notify_id = 0; - priv->alpha = NULL; - } - if (!alpha) { ClutterTimeline *timeline; @@ -1068,7 +1063,19 @@ clutter_animation_set_alpha (ClutterAnimation *animation, clutter_animation_set_mode_internal (animation, alpha); } - priv->alpha = g_object_ref_sink (alpha); + g_object_ref_sink (alpha); + + if (priv->alpha) + { + if (priv->alpha_notify_id) + g_signal_handler_disconnect (priv->alpha, priv->alpha_notify_id); + + g_object_unref (priv->alpha); + priv->alpha_notify_id = 0; + priv->alpha = NULL; + } + + priv->alpha = alpha; priv->alpha_notify_id = g_signal_connect (alpha, "notify::alpha", -- 2.7.4