[libchamplain/libchamplain-0-12] Don't use idle function when animating markers



commit 83b363fbef08325ae5561323e7c051f64e36d3e3
Author: JiÅÃ Techet <techet gmail com>
Date:   Sun Nov 20 00:16:07 2011 +0100

    Don't use idle function when animating markers
    
    Use of idle functions is dangerous in clutter because actors
    can be destroyed by clutter_actor_destroy() even if they are
    reffed.

 champlain/champlain-marker.c |   23 ++++-------------------
 1 files changed, 4 insertions(+), 19 deletions(-)
---
diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c
index ec420e0..a6f24b0 100644
--- a/champlain/champlain-marker.c
+++ b/champlain/champlain-marker.c
@@ -800,28 +800,13 @@ champlain_marker_animate_out (ChamplainMarker *marker)
 }
 
 
-static gboolean
-on_idle (ChamplainMarker *marker)
-{
-  /* Notify the view that the position changed so that the marker's
-   * position is reset, it has to happen on idle as Clutter seems to
-   * set actors position after calling animation_completed */
-  clutter_actor_hide (CLUTTER_ACTOR (marker));
-
-  g_object_notify (G_OBJECT (marker), "latitude");
-  g_object_notify (G_OBJECT (marker), "longitude");
-  return FALSE;
-}
-
-
 static void
 on_animation_completed (G_GNUC_UNUSED ClutterAnimation *animation,
     ChamplainMarker *marker)
 {
-  g_idle_add_full (CLUTTER_PRIORITY_REDRAW,
-      (GSourceFunc) on_idle,
-      g_object_ref (marker),
-      (GDestroyNotify) g_object_unref);
+  clutter_actor_hide (CLUTTER_ACTOR (marker));
+
+  clutter_actor_move_by (CLUTTER_ACTOR (marker), 0, 100);
 }
 
 
@@ -858,6 +843,6 @@ champlain_marker_animate_out_with_delay (ChamplainMarker *marker,
         "scale-x", 2.0, 
         "scale-y", 2.0, 
         NULL);
-  g_signal_connect (animation, "completed",
+  g_signal_connect_after (animation, "completed",
       G_CALLBACK (on_animation_completed), marker);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]