Don't ignore initialisation errors

server_init ignores all errors. In practice, theses result in a
segfault, potentially much later and losing any unsaved work.

Properly handle initialisation errors and bail immediately.

(cherry picked from commit 1606311553)
This commit is contained in:
Hugo Osvaldo Barrera 2026-04-09 02:09:59 +02:00 committed by Simon Ser
parent faedde4e77
commit 0df0173102
5 changed files with 222 additions and 23 deletions

View file

@ -97,17 +97,18 @@ static void handle_commit(struct wl_listener *listener, void *data) {
}
// Initialize ext-workspace. Must be called once at startup.
void sway_ext_workspace_init(void) {
bool sway_ext_workspace_init(void) {
server.workspace_manager_v1 =
wlr_ext_workspace_manager_v1_create(server.wl_display, 1);
if (!server.workspace_manager_v1) {
sway_log(SWAY_ERROR, "Failed to create ext_workspace_manager_v1");
return;
return false;
}
server.workspace_manager_v1_commit.notify = handle_commit;
wl_signal_add(&server.workspace_manager_v1->events.commit,
&server.workspace_manager_v1_commit);
return true;
}
// Must be called whenever an output is enabled.