animator: fix crash when setting keys on running animator
authorØyvind Kolås <pippin@linux.intel.com>
Wed, 5 May 2010 12:34:06 +0000 (13:34 +0100)
committerØyvind Kolås <pippin@linux.intel.com>
Wed, 5 May 2010 17:24:53 +0000 (18:24 +0100)
When inserting or modifying keys of a running animator the internal
iterators per property could go out of sync. Reinitializing the
iterators if the timeline is running avoids this.

clutter/clutter-animator.c

index 21cbbe0..80e08fb 100644 (file)
@@ -1259,6 +1259,10 @@ clutter_animator_set_key_internal (ClutterAnimator    *animator,
 
   priv->score = g_list_insert_sorted (priv->score, key,
                                       sort_actor_prop_progress_func);
+
+  /* if the animator is already running reinitialize internal iterators */
+  if (clutter_timeline_is_playing (priv->timeline))
+    animation_animator_started (priv->timeline, animator);
 }
 
 /**