Bug 1395 - apply and get_nth_actor are inconsistent
authorEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 23 Jan 2009 16:22:02 +0000 (16:22 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Sat, 24 Jan 2009 14:32:09 +0000 (14:32 +0000)
When calling clutter_behaviour_apply() the new actor is prepended
to the list of actors to which a behaviour is applied; this breaks
the rest of methods working on the actors list, e.g.:

  # adding actors
  apply(actor_0);
  apply(actor_1);
  apply(actor_2);

  # expected: [ actor_0, actor_1, actor_2 ]
  [ actor_2, actor_1, actor_0 ] = get_actors();

  # expected: actor_2
  actor_0 = get_nth_actor(2);

This commit fixes the inconsistency in the returned values.

clutter/clutter-behaviour.c

index f4bdf54..6cb543f 100644 (file)
@@ -362,7 +362,7 @@ clutter_behaviour_apply (ClutterBehaviour *behave,
       return;
     }
 
-  priv->actors = g_slist_prepend (priv->actors, g_object_ref (actor));
+  priv->actors = g_slist_append (priv->actors, g_object_ref (actor));
   g_signal_connect (actor, "destroy",
                     G_CALLBACK (remove_actor_on_destroy),
                     behave);
@@ -627,7 +627,7 @@ clutter_behaviour_get_actors (ClutterBehaviour *behave)
   for (l = priv->actors; l != NULL; l = l->next)
     retval = g_slist_prepend (retval, l->data);
 
-  return retval;
+  return g_slist_reverse (retval);
 }
 
 /**