diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-07-09 22:28:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-09 22:28:19 -0400 |
commit | be064df25ee7c03543bb86d27addaa297682fba7 (patch) | |
tree | 8b70817fe1ca341cb9868f49f4127e4e987da68a /examples | |
parent | 8920b5d607c6b3b5d04894fc1837ac4f2d9558ae (diff) | |
parent | ceef12cb5a2a9347a1494332d320742c92fbd539 (diff) |
Merge pull request #25 from ascent12/forking
Forking session backend
Diffstat (limited to 'examples')
-rw-r--r-- | examples/shared.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/shared.c b/examples/shared.c index fbb6c559..6d225a85 100644 --- a/examples/shared.c +++ b/examples/shared.c @@ -466,6 +466,7 @@ void compositor_init(struct compositor_state *state) { struct wlr_backend *wlr = wlr_backend_autocreate( state->display, state->session); if (!wlr) { + wlr_session_finish(state->session); exit(1); } wl_signal_add(&wlr->events.input_add, &state->input_add); @@ -477,10 +478,19 @@ void compositor_init(struct compositor_state *state) { clock_gettime(CLOCK_MONOTONIC, &state->last_frame); const char *socket = wl_display_add_socket_auto(state->display); + if (!socket) { + wlr_log_errno(L_ERROR, "Unable to open wayland socket"); + wlr_backend_destroy(wlr); + wlr_session_finish(state->session); + exit(1); + } + wlr_log(L_INFO, "Running compositor on wayland display '%s'", socket); setenv("_WAYLAND_DISPLAY", socket, true); if (!wlr_backend_init(state->backend)) { wlr_log(L_ERROR, "Failed to initialize backend"); + wlr_backend_destroy(wlr); + wlr_session_finish(state->session); exit(1); } } |