From: Pierre-Luc Beaudoin Date: Sat, 13 Jun 2009 20:27:52 +0000 (-0400) Subject: Stop any ongoing animation before disposing X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73bf2e0c38bec7b794378a9e28aafd26b3c3f3eb;p=libchamplain Stop any ongoing animation before disposing --- diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index 5ca635e..7958136 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -649,12 +649,14 @@ champlain_view_dispose (GObject *object) if (priv->finger_scroll != NULL) { + tidy_finger_scroll_stop (TIDY_FINGER_SCROLL (priv->finger_scroll)); g_object_unref (priv->finger_scroll); priv->finger_scroll = NULL; } if (priv->viewport != NULL) { + tidy_viewport_stop (TIDY_VIEWPORT (priv->viewport)); g_object_unref (priv->viewport); priv->viewport = NULL; } diff --git a/tidy/tidy-adjustment.c b/tidy/tidy-adjustment.c index 82fe95c..3e14a53 100644 --- a/tidy/tidy-adjustment.c +++ b/tidy/tidy-adjustment.c @@ -197,6 +197,12 @@ stop_interpolation (TidyAdjustment *adjustment) } } +void +tidy_adjustment_interpolate_stop (TidyAdjustment *adjustment) +{ + stop_interpolation (adjustment); +} + static void tidy_adjustment_dispose (GObject *object) { @@ -754,7 +760,7 @@ tidy_adjustment_interpolatex (TidyAdjustment *adjustment, TidyAdjustmentPrivate *priv = adjustment->priv; stop_interpolation (adjustment); - + if (n_frames <= 1) { tidy_adjustment_set_valuex (adjustment, value); @@ -763,7 +769,7 @@ tidy_adjustment_interpolatex (TidyAdjustment *adjustment, priv->old_position = priv->value; priv->new_position = value; - + priv->dx = clutter_qdivx (priv->new_position - priv->old_position, CLUTTER_INT_TO_FIXED (n_frames)); priv->interpolation = clutter_timeline_new (n_frames, fps); diff --git a/tidy/tidy-adjustment.h b/tidy/tidy-adjustment.h index cd51049..98f531e 100644 --- a/tidy/tidy-adjustment.h +++ b/tidy/tidy-adjustment.h @@ -141,6 +141,7 @@ gboolean tidy_adjustment_clamp (TidyAdjustment *adjustment, gboolean interpolate, guint n_frames, guint fps); +void tidy_adjustment_interpolate_stop (TidyAdjustment *adjustment); G_END_DECLS diff --git a/tidy/tidy-viewport.c b/tidy/tidy-viewport.c index 33602e0..47dddf0 100644 --- a/tidy/tidy-viewport.c +++ b/tidy/tidy-viewport.c @@ -160,7 +160,7 @@ tidy_viewport_set_property (GObject *object, priv->hadjustment, g_value_get_object (value)); break; - + case PROP_SYNC_ADJUST : priv->sync_adjustments = g_value_get_boolean (value); break; @@ -171,19 +171,30 @@ tidy_viewport_set_property (GObject *object, } } +void +tidy_viewport_stop (TidyViewport *viewport) +{ + TidyViewportPrivate *priv = TIDY_VIEWPORT (viewport)->priv; + + tidy_adjustment_interpolate_stop (priv->hadjustment); + tidy_adjustment_interpolate_stop (priv->vadjustment); +} + static void tidy_viewport_dispose (GObject *gobject) { TidyViewportPrivate *priv = TIDY_VIEWPORT (gobject)->priv; - + if (priv->hadjustment) { + tidy_adjustment_interpolate_stop (priv->hadjustment); g_object_unref (priv->hadjustment); priv->hadjustment = NULL; } if (priv->vadjustment) { + tidy_adjustment_interpolate_stop (priv->vadjustment); g_object_unref (priv->vadjustment); priv->vadjustment = NULL; } diff --git a/tidy/tidy-viewport.h b/tidy/tidy-viewport.h index eb457bf..2278367 100644 --- a/tidy/tidy-viewport.h +++ b/tidy/tidy-viewport.h @@ -74,6 +74,7 @@ void tidy_viewport_get_origin (TidyViewport *viewport, gint *x, gint *y, gint *z); +void tidy_viewport_stop (TidyViewport *viewport); G_END_DECLS