From: Ray Strode Date: Thu, 29 May 2008 04:16:08 +0000 (-0400) Subject: Set up event loop exit handler in plugins on show success X-Git-Tag: 0.1.0~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93ac9f7b1c1d605e313f91cc2eb9324a7b71ba1f;p=thirdparty%2Fplymouth.git Set up event loop exit handler in plugins on show success 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. --- diff --git a/src/splash-plugins/fade-in/plugin.c b/src/splash-plugins/fade-in/plugin.c index 4540413a..1056fd40 100644 --- a/src/splash-plugins/fade-in/plugin.c +++ b/src/splash-plugins/fade-in/plugin.c @@ -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) diff --git a/src/splash-plugins/spinfinity/plugin.c b/src/splash-plugins/spinfinity/plugin.c index 62701b38..84dfa50f 100644 --- a/src/splash-plugins/spinfinity/plugin.c +++ b/src/splash-plugins/spinfinity/plugin.c @@ -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)