]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Set up event loop exit handler in plugins on show success
authorRay Strode <rstrode@redhat.com>
Thu, 29 May 2008 04:16:08 +0000 (00:16 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 29 May 2008 04:16:08 +0000 (00:16 -0400)
Previously we were setting up the exit handler at the top
of the show vtable function.  This meant having to remove
the exit handler if the show fails. It's much easier to
not set up the handler until after we know we're going to
succeed.

src/splash-plugins/fade-in/plugin.c
src/splash-plugins/spinfinity/plugin.c

index 4540413aaf30458be457065ce3d1bf5219ae53cf..1056fd4044adaf10dadc04781deb39c3f3995863 100644 (file)
@@ -423,9 +423,6 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
                                 on_enter, plugin);
 
   plugin->loop = loop;
-  ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
-                                 detach_from_event_loop,
-                                 plugin);
 
   ply_trace ("loading logo image");
   if (!ply_image_load (plugin->logo_image))
@@ -449,18 +446,16 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
 
   ply_trace ("opening frame buffer");
   if (!ply_frame_buffer_open (plugin->frame_buffer))
-    {
-      ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)
-                                             detach_from_event_loop,
-                                             plugin);
-      return false;
-    }
+    return false;
 
   plugin->window = window;
 
   if (!ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_GRAPHICS))
     return false;
 
+  ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
+                                 detach_from_event_loop,
+                                 plugin);
   ply_event_loop_watch_signal (plugin->loop,
                                SIGINT,
                                (ply_event_handler_t) 
index 62701b38450523d7bc62519cc5aefb6db197caba..84dfa50fc70c0faf9af657ce616639d495848f0a 100644 (file)
@@ -301,9 +301,6 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
                                 on_enter, plugin);
 
   plugin->loop = loop;
-  ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
-                                 detach_from_event_loop,
-                                 plugin);
 
   ply_trace ("loading logo image");
   if (!ply_image_load (plugin->logo_image))
@@ -327,18 +324,17 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
 
   ply_trace ("opening frame buffer");
   if (!ply_frame_buffer_open (plugin->frame_buffer))
-    {
-      ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)
-                                             detach_from_event_loop,
-                                             plugin);
-      return false;
-    }
+    return false;
 
   plugin->window = window;
 
   if (!ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_GRAPHICS))
     return false;
 
+  ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
+                                 detach_from_event_loop,
+                                 plugin);
+
   ply_event_loop_watch_signal (plugin->loop,
                                SIGINT,
                                (ply_event_handler_t)