scroll-actor: Fix ->transition not being reset
authorBastien Nocera <hadess@hadess.net>
Fri, 18 May 2012 16:34:18 +0000 (17:34 +0100)
committerBastien Nocera <hadess@hadess.net>
Fri, 18 May 2012 16:36:44 +0000 (17:36 +0100)
When the transition was removed from the scroll-actor manually,
to cancel a not-finished animation, the transition struct member
wasn't reset to NULL.

This fixes this problem, and removes the need for the struct member
to be reset manually when animation has completed.

https://bugzilla.gnome.org/show_bug.cgi?id=676334

clutter/clutter-scroll-actor.c

index 6e534a0..5a6662c 100644 (file)
@@ -397,13 +397,6 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
   return actor->priv->scroll_mode;
 }
 
-static void
-on_transition_completed (ClutterTimeline *timeline,
-                         ClutterScrollActor *actor)
-{
-  actor->priv->transition = NULL;
-}
-
 /**
  * clutter_scroll_actor_scroll_to_point:
  * @actor: a #ClutterScrollActor
@@ -466,9 +459,7 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
       clutter_timeline_set_delay (CLUTTER_TIMELINE (priv->transition),
                                   info->cur_state->easing_delay);
       /* we need this to clear the priv->transition pointer */
-      g_signal_connect (priv->transition, "completed",
-                        G_CALLBACK (on_transition_completed),
-                        actor);
+      g_object_add_weak_pointer (G_OBJECT (priv->transition), (gpointer *) &priv->transition);
 
       clutter_actor_add_transition (CLUTTER_ACTOR (actor),
                                     "scroll-to",