Skip to content

clutter/actor: Cancel a delayed timeline on removal

Marco Trevisan requested to merge 3v1n0/mutter:delayed-timeline-cancel into master

A delayed clutter timeline might be removed while is still in the process of being executed, but if it's not playing yet its delay timeout won't be stopped, causing it to be executed anyway, leading to a potential crash.

In fact if something else keeps a reference on the timeline (i.e. gjs) the dispose delay cancellation won't take effect, causing the timeline to be started and added to the master clock.

To avoid this, expose clutter_timeline_cancel_delay() function and call it if the timeline is not playing but has a delay set.

Fixes #815 (closed)


The fix itself might just be done with this, but.... I preferred to be explicit :)

diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index f600a838c..16c71af7c 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -19482,8 +19482,7 @@ transition_closure_free (gpointer data)
        */
       g_signal_handler_disconnect (clos->transition, clos->completed_id);
 
-      if (clutter_timeline_is_playing (timeline))
-        clutter_timeline_stop (timeline);
+      clutter_timeline_stop (timeline);
 
       /* remove the reference added in add_transition_internal() */
       g_object_unref (clos->transition);

Let me know, though

Edited by Marco Trevisan

Merge request reports