From 63a0b702c94af013b94ad3f32a8c5ba86bf6dfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 20 Sep 2019 16:13:03 +0200 Subject: [PATCH] clutter/timeline: Use a function to cancel the delay timeout Avoid repeating the same code for canceling the delay timeout, using a function for later uses. https://gitlab.gnome.org/GNOME/mutter/merge_requests/805 --- clutter/clutter/clutter-timeline.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/clutter/clutter/clutter-timeline.c b/clutter/clutter/clutter-timeline.c index 0c026ebe8..df7db160b 100644 --- a/clutter/clutter/clutter-timeline.c +++ b/clutter/clutter/clutter-timeline.c @@ -424,6 +424,11 @@ clutter_timeline_set_custom_property (ClutterScriptable *scriptable, g_object_set_property (G_OBJECT (scriptable), name, value); } +static void +clutter_timeline_cancel_delay (ClutterTimeline *timeline) +{ + g_clear_handle_id (&timeline->priv->delay_id, g_source_remove); +} static void clutter_scriptable_iface_init (ClutterScriptableIface *iface) @@ -550,11 +555,7 @@ clutter_timeline_dispose (GObject *object) priv = self->priv; - if (priv->delay_id) - { - g_source_remove (priv->delay_id); - priv->delay_id = 0; - } + clutter_timeline_cancel_delay (self); if (priv->progress_notify != NULL) { @@ -1216,11 +1217,7 @@ clutter_timeline_pause (ClutterTimeline *timeline) if (priv->delay_id == 0 && !priv->is_playing) return; - if (priv->delay_id) - { - g_source_remove (priv->delay_id); - priv->delay_id = 0; - } + clutter_timeline_cancel_delay (timeline); priv->msecs_delta = 0; set_is_playing (timeline, FALSE);