From: Ray Strode Date: Tue, 28 Jul 2015 14:00:25 +0000 (-0400) Subject: animation,throbber: allow calling stop after animation is stopped X-Git-Tag: 0.9.3~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02c70f069bd3293e883b329ec696d1ba73da8e8c;p=thirdparty%2Fplymouth.git animation,throbber: allow calling stop after animation is stopped 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 --- diff --git a/src/libply-splash-graphics/ply-animation.c b/src/libply-splash-graphics/ply-animation.c index 81348f9c..323d9edc 100644 --- a/src/libply-splash-graphics/ply-animation.c +++ b/src/libply-splash-graphics/ply-animation.c @@ -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; diff --git a/src/libply-splash-graphics/ply-throbber.c b/src/libply-splash-graphics/ply-throbber.c index c9c5bbdc..f18feb61 100644 --- a/src/libply-splash-graphics/ply-throbber.c +++ b/src/libply-splash-graphics/ply-throbber.c @@ -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;