From: Ray Strode Date: Wed, 24 Oct 2012 17:08:41 +0000 (-0400) Subject: throbber: stop throbber when freed X-Git-Tag: 0.8.8~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a91db63f11527e49bef344027fadb06d73057b19;p=thirdparty%2Fplymouth.git throbber: stop throbber when freed 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. --- diff --git a/src/libply-splash-graphics/ply-throbber.c b/src/libply-splash-graphics/ply-throbber.c index 5b9678cd..59cf10c6 100644 --- a/src/libply-splash-graphics/ply-throbber.c +++ b/src/libply-splash-graphics/ply-throbber.c @@ -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);