]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
animation,throbber: allow calling stop after animation is stopped
authorRay Strode <rstrode@redhat.com>
Tue, 28 Jul 2015 14:00:25 +0000 (10:00 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 30 Jul 2015 20:03:11 +0000 (16:03 -0400)
Right now if a user calls ply_throbber_stop or ply_animation_stop
after the animation is stopped things malfunction.  In the case
of the throbber we end up never calling the stop completion handler
passed in, and in the case of the animation, we end up setting
some state that shouldn't be set.

This commit checks if the animation and throbber objects are stopped,
and if so does the necessary steps to process the late stop request.

Spotted by Dave Airlie

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

index 81348f9c1780282db1e98b88d9bc6885e24068c2..323d9edce9eda1289948fe4bddca3f8c02271627 100644 (file)
@@ -353,6 +353,11 @@ ply_animation_stop_now (ply_animation_t *animation)
 void
 ply_animation_stop (ply_animation_t *animation)
 {
+        if (animation->is_stopped) {
+                ply_trace ("animation already stopped, ignoring stop request");
+                return;
+        }
+
         if (animation->stop_trigger == NULL) {
                 ply_animation_stop_now (animation);
                 return;
index c9c5bbdccc9d822bbea18be043bb52d90d2ffd84..f18feb612352e3ca5813e182bdba2e53051f6387 100644 (file)
@@ -337,6 +337,15 @@ void
 ply_throbber_stop (ply_throbber_t *throbber,
                    ply_trigger_t  *stop_trigger)
 {
+        if (throbber->is_stopped) {
+                ply_trace ("throbber already stopped");
+                if (stop_trigger != NULL) {
+                        ply_trace ("pulling stop trigger right away");
+                        ply_trigger_pull (stop_trigger, NULL);
+                }
+                return;
+        }
+
         if (stop_trigger == NULL) {
                 ply_throbber_stop_now (throbber);
                 return;