]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
throbber: stop throbber when freed
authorRay Strode <rstrode@redhat.com>
Wed, 24 Oct 2012 17:08:41 +0000 (13:08 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 24 Oct 2012 17:13:28 +0000 (13:13 -0400)
It's possible that a throbber could get freed while animating.
In that case, stop the animation right away, so we don't keep
running the animation timeout on freed memory.

src/libply-splash-graphics/ply-throbber.c

index 5b9678cd59db626cca8b77fa7f3e284bf3664f9d..59cf10c6ce5f826d4d2aa25915e0212e4233a3e2 100644 (file)
@@ -78,6 +78,8 @@ struct _ply_throbber
   uint32_t is_stopped : 1;
 };
 
+static void ply_throbber_stop_now (ply_throbber_t *throbber);
+
 ply_throbber_t *
 ply_throbber_new (const char *image_dir,
               const char *frames_prefix)
@@ -122,6 +124,9 @@ ply_throbber_free (ply_throbber_t *throbber)
   if (throbber == NULL)
     return;
 
+  if (!throbber->is_stopped)
+    ply_throbber_stop_now (throbber);
+
   ply_throbber_remove_frames (throbber);
   ply_array_free (throbber->frames);