]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-boot-splash: Do not add ply_boot_splash_update_progress timeout multiple times
authorHans de Goede <hdegoede@redhat.com>
Wed, 16 Jan 2019 11:51:05 +0000 (12:51 +0100)
committerHans de Goede <hdegoede@redhat.com>
Sat, 23 Feb 2019 14:01:02 +0000 (15:01 +0100)
Before this commit when freeing the splash, the following would be logged:

multiple matching timeouts found for removal
multiple matching timeouts found for removal

This is caused by us adding the ply_boot_splash_update_progress timeout
handler to the event loop 3 times: 1 on first show, 2 on second show with
a different mode, 3 on becoming idle.

This commit fixes the 2nd add by stopping the timer when changing modes
and the 3th add by not calling ply_boot_splash_update_progress to update
the progress, as that will re-add itself. Instead this commit directly calls
plugin_interface->on_boot_progress from ply_boot_splash_become_idle.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
src/libply-splash-core/ply-boot-splash.c

index 54c769650ccb2849f9388f1eb4336c4950a621aa..9549ecccb4080660048373e2ad76d392b4cc0648 100644 (file)
@@ -476,6 +476,11 @@ ply_boot_splash_show (ply_boot_splash_t     *splash,
         } else if (splash->mode != PLY_BOOT_SPLASH_MODE_INVALID) {
                 splash->plugin_interface->hide_splash_screen (splash->plugin,
                                                               splash->loop);
+                if (splash->plugin_interface->on_boot_progress != NULL) {
+                        ply_event_loop_stop_watching_for_timeout (splash->loop,
+                                                                  (ply_event_loop_timeout_handler_t)
+                                                                  ply_boot_splash_update_progress, splash);
+                }
         }
 
         ply_trace ("showing splash screen");
@@ -671,9 +676,12 @@ ply_boot_splash_become_idle (ply_boot_splash_t                *splash,
 {
         assert (splash->idle_trigger == NULL);
 
-        if (splash->progress != NULL) {
+        if (splash->plugin_interface->on_boot_progress != NULL &&
+            splash->progress != NULL) {
                 ply_progress_set_percentage (splash->progress, 1.0);
-                ply_boot_splash_update_progress (splash);
+                splash->plugin_interface->on_boot_progress (splash->plugin,
+                                                            ply_progress_get_time (splash->progress),
+                                                            1.0);
         }
 
         ply_trace ("telling splash to become idle");