[PATCH] fix "plymouth quit" if "plymouth ask-for-password" waits until progress 100%.

Dr. Tilmann Bubeck t.bubeck at reinform.de
Wed May 2 09:18:13 PDT 2012


This fixes https://bugs.freedesktop.org/show_bug.cgi?id=49355

The problem was, that while "plymouth ask-for-password" waits for the user
to enter the password, "on_boot_progress" is being called in the background
with increasing "percent_done". When it reaches SHOW_ANIMATION_PERCENT
then "on_boot_progress" calls "start_end_animation" which in turn pulls
the idle trigger.

If the user then enters the password, then "display_normal" calls
"start_progress_animation" which will set the plugin to "is_idle=false".

When we then receive the quit message, the plugin is not idle anymore
(which is wrong, it is idle, because the idle trigger has been called), and
the idle trigger gets lost.

Therefore "quit" never finishes and plymouthd never calls "exit()".

This bug is probably in some other splash plugins, too.
---
 src/plugins/splash/two-step/plugin.c |   74 +++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c
index b8caccc..b43488e 100644
--- a/src/plugins/splash/two-step/plugin.c
+++ b/src/plugins/splash/two-step/plugin.c
@@ -1081,43 +1081,43 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin,
                   double                    duration,
                   double                    percent_done)
 {
-
-
-  if (percent_done >= SHOW_ANIMATION_PERCENT)
-    {
-      if (plugin->stop_trigger == NULL)
-        {
-          ply_trace ("boot progressed to end");
-
-          plugin->stop_trigger = ply_trigger_new (&plugin->stop_trigger);
-          ply_trigger_add_handler (plugin->stop_trigger,
-                                   (ply_trigger_handler_t)
-                                   on_animation_stopped,
-                                   plugin);
-          start_end_animation (plugin, plugin->stop_trigger);
-        }
-    }
-  else
-    {
-      double total_duration;
-
-      percent_done *= (1 / SHOW_ANIMATION_PERCENT);
-
-      switch (plugin->progress_function)
-        {
-          /* Fun made-up smoothing function to make the growth asymptotic:
-           * fraction(time,estimate)=1-2^(-(time^1.45)/estimate) */
-          case PROGRESS_FUNCTION_TYPE_WWOODS:
-            total_duration = duration / percent_done;
-            percent_done = 1.0 - pow (2.0, -pow (duration, 1.45) / total_duration) * (1.0 - percent_done);
-            break;
-
-          case PROGRESS_FUNCTION_TYPE_LINEAR:
-            break;
-        }
-
-      update_progress_animation (plugin, percent_done);
-    }
+  if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL) {
+    if (percent_done >= SHOW_ANIMATION_PERCENT)
+      {
+	if (plugin->stop_trigger == NULL)
+	  {
+	    ply_trace ("boot progressed to end");
+	    
+	    plugin->stop_trigger = ply_trigger_new (&plugin->stop_trigger);
+	    ply_trigger_add_handler (plugin->stop_trigger,
+				     (ply_trigger_handler_t)
+				     on_animation_stopped,
+				     plugin);
+	    start_end_animation (plugin, plugin->stop_trigger);
+	  }
+      }
+    else
+      {
+	double total_duration;
+
+	percent_done *= (1 / SHOW_ANIMATION_PERCENT);
+
+	switch (plugin->progress_function)
+	  {
+            /* Fun made-up smoothing function to make the growth asymptotic:
+             * fraction(time,estimate)=1-2^(-(time^1.45)/estimate) */
+            case PROGRESS_FUNCTION_TYPE_WWOODS:
+	      total_duration = duration / percent_done;
+	      percent_done = 1.0 - pow (2.0, -pow (duration, 1.45) / total_duration) * (1.0 - percent_done);
+	      break;
+
+            case PROGRESS_FUNCTION_TYPE_LINEAR:
+	      break;
+	  }
+
+	update_progress_animation (plugin, percent_done);
+      }
+  }
 }
 
 static void
-- 
1.7.7.6



More information about the plymouth mailing list