[PATCH 01/20] [main] give quit command precedence over deactivate

Scott James Remnant scott at ubuntu.com
Thu Mar 18 13:22:53 PDT 2010


In the cases where the boot splash plugin does not become idle
immediately, we go back into the main loop and can receive additional
commands.

Since quit and deactive both use this facility, one scenario is the
quit command arriving after the deactivate command, but before the
deactivate command has actually been run.

In that situation, we want to quit, not deactivate.
---
 src/main.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/main.c b/src/main.c
index a865a1d..bc896a0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -712,10 +712,26 @@ quit_program (state_t *state)
 static void
 on_boot_splash_idle (state_t *state)
 {
-
   ply_trace ("boot splash idle");
 
-  if (state->deactivate_trigger != NULL)
+  /* In the case where we've received both a deactivate command and a
+   * quit command, the quit command takes precedence.
+   */
+  if (state->quit_trigger != NULL)
+    {
+      if (!state->should_retain_splash)
+        {
+          ply_trace ("hiding splash");
+          if (state->boot_splash != NULL)
+            ply_boot_splash_hide (state->boot_splash);
+        }
+
+      ply_trace ("quitting splash");
+      quit_splash (state);
+      ply_trace ("quitting program");
+      quit_program (state);
+    }
+  else if (state->deactivate_trigger != NULL)
     {
       if (state->renderer != NULL)
         {
@@ -729,21 +745,7 @@ on_boot_splash_idle (state_t *state)
       ply_trigger_pull (state->deactivate_trigger, NULL);
       state->deactivate_trigger = NULL;
       state->is_inactive = true;
-
-      return;
     }
-
-  if (!state->should_retain_splash)
-    {
-      ply_trace ("hiding splash");
-      if (state->boot_splash != NULL)
-          ply_boot_splash_hide (state->boot_splash);
-    }
-
-  ply_trace ("quitting splash");
-  quit_splash (state);
-  ply_trace ("quitting program");
-  quit_program (state);
 }
 
 
-- 
1.7.0



More information about the plymouth mailing list