On Mon, Jul 30, 2012 at 04:56:57PM +0300, Pekka Paalanen wrote: > Simply exit(1)'ing the program will leave the VT unusable, since > DRM backend's clean-up does not run. > > After a backend has been initialised, prefer jumping to clean-up instead > of directly exiting. > > This fixes the case where 'weston-launch -- -i 5' would leave the > console unusable.
Thanks, that's a good improvement. Kristian > Signed-off-by: Pekka Paalanen <ppaala...@gmail.com> > --- > src/compositor.c | 34 ++++++++++++++++++++++------------ > 1 files changed, 22 insertions(+), 12 deletions(-) > > diff --git a/src/compositor.c b/src/compositor.c > index 746ff85..c659527 100644 > --- a/src/compositor.c > +++ b/src/compositor.c > @@ -3489,14 +3489,16 @@ int main(int argc, char *argv[]) > > ec = backend_init(display, argc, argv, config_file); > if (ec == NULL) { > - weston_log("failed to create compositor\n"); > + weston_log("fatal: failed to create compositor\n"); > exit(EXIT_FAILURE); > } > > for (i = 1; argv[i]; i++) > - weston_log("unhandled option: %s\n", argv[i]); > - if (argv[1]) > - exit(EXIT_FAILURE); > + weston_log("fatal: unhandled option: %s\n", argv[i]); > + if (argv[1]) { > + ret = EXIT_FAILURE; > + goto out; > + } > > free(config_file); > > @@ -3508,25 +3510,32 @@ int main(int argc, char *argv[]) > module_init = load_module("xwayland.so", > "weston_xserver_init", > &xserver_module); > - if (module_init && module_init(ec) < 0) > - exit(EXIT_FAILURE); > + if (module_init && module_init(ec) < 0) { > + ret = EXIT_FAILURE; > + goto out; > + } > > if (!shell) > shell = "desktop-shell.so"; > module_init = load_module(shell, "shell_init", &shell_module); > - if (!module_init || module_init(ec) < 0) > - exit(EXIT_FAILURE); > + if (!module_init || module_init(ec) < 0) { > + ret = EXIT_FAILURE; > + goto out; > + } > > > module_init = NULL; > if (module) > module_init = load_module(module, "module_init", NULL); > - if (module_init && module_init(ec) < 0) > - exit(EXIT_FAILURE); > + if (module_init && module_init(ec) < 0) { > + ret = EXIT_FAILURE; > + goto out; > + } > > if (wl_display_add_socket(display, socket_name)) { > - weston_log("failed to add socket: %m\n"); > - exit(EXIT_FAILURE); > + weston_log("fatal: failed to add socket: %m\n"); > + ret = EXIT_FAILURE; > + goto out; > } > > weston_compositor_dpms_on(ec); > @@ -3536,6 +3545,7 @@ int main(int argc, char *argv[]) > else > ret = EXIT_FAILURE; > > +out: > /* prevent further rendering while shutting down */ > ec->state = WESTON_COMPOSITOR_SLEEPING; > > -- > 1.7.8.6 > _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel