compositor: do clean-up on init failure
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. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
69f9840bed
commit
3361639b7b
+22
-12
@@ -3489,14 +3489,16 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
ec = backend_init(display, argc, argv, config_file);
|
ec = backend_init(display, argc, argv, config_file);
|
||||||
if (ec == NULL) {
|
if (ec == NULL) {
|
||||||
weston_log("failed to create compositor\n");
|
weston_log("fatal: failed to create compositor\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; argv[i]; i++)
|
for (i = 1; argv[i]; i++)
|
||||||
weston_log("unhandled option: %s\n", argv[i]);
|
weston_log("fatal: unhandled option: %s\n", argv[i]);
|
||||||
if (argv[1])
|
if (argv[1]) {
|
||||||
exit(EXIT_FAILURE);
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
free(config_file);
|
free(config_file);
|
||||||
|
|
||||||
@@ -3508,25 +3510,32 @@ int main(int argc, char *argv[])
|
|||||||
module_init = load_module("xwayland.so",
|
module_init = load_module("xwayland.so",
|
||||||
"weston_xserver_init",
|
"weston_xserver_init",
|
||||||
&xserver_module);
|
&xserver_module);
|
||||||
if (module_init && module_init(ec) < 0)
|
if (module_init && module_init(ec) < 0) {
|
||||||
exit(EXIT_FAILURE);
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!shell)
|
if (!shell)
|
||||||
shell = "desktop-shell.so";
|
shell = "desktop-shell.so";
|
||||||
module_init = load_module(shell, "shell_init", &shell_module);
|
module_init = load_module(shell, "shell_init", &shell_module);
|
||||||
if (!module_init || module_init(ec) < 0)
|
if (!module_init || module_init(ec) < 0) {
|
||||||
exit(EXIT_FAILURE);
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
module_init = NULL;
|
module_init = NULL;
|
||||||
if (module)
|
if (module)
|
||||||
module_init = load_module(module, "module_init", NULL);
|
module_init = load_module(module, "module_init", NULL);
|
||||||
if (module_init && module_init(ec) < 0)
|
if (module_init && module_init(ec) < 0) {
|
||||||
exit(EXIT_FAILURE);
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (wl_display_add_socket(display, socket_name)) {
|
if (wl_display_add_socket(display, socket_name)) {
|
||||||
weston_log("failed to add socket: %m\n");
|
weston_log("fatal: failed to add socket: %m\n");
|
||||||
exit(EXIT_FAILURE);
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
weston_compositor_dpms_on(ec);
|
weston_compositor_dpms_on(ec);
|
||||||
@@ -3536,6 +3545,7 @@ int main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
|
|
||||||
|
out:
|
||||||
/* prevent further rendering while shutting down */
|
/* prevent further rendering while shutting down */
|
||||||
ec->state = WESTON_COMPOSITOR_SLEEPING;
|
ec->state = WESTON_COMPOSITOR_SLEEPING;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user