summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2012-10-24 13:08:41 -0400
committerRay Strode <rstrode@redhat.com>2012-10-24 13:13:28 -0400
commita91db63f11527e49bef344027fadb06d73057b19 (patch)
treecb50f24e33ebd3460d0b1a584a07133c58b78c9a
parentfcf947fe7cc979f601103e73fee2768b21042c5c (diff)
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.
-rw-r--r--src/libply-splash-graphics/ply-throbber.c5
1 files changed, 5 insertions, 0 deletions
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);