diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-12-21 18:38:58 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-12-21 18:38:58 -0500 |
commit | 4cec7f54e24a58fd9756395ce64a5bd73f412c9e (patch) | |
tree | b00eb27649a61035af82b735673e6fd780862f9b | |
parent | 9871cde60433699468e2bd30b60382904173ba55 (diff) |
only add first backend to multi autocreate
-rw-r--r-- | backend/backend.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/backend/backend.c b/backend/backend.c index 359ee0e5..6b32bc6a 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -33,6 +33,10 @@ bool wlr_backend_start(struct wlr_backend *backend) { } void wlr_backend_destroy(struct wlr_backend *backend) { + if (!backend) { + return; + } + wl_signal_emit(&backend->events.destroy, backend); if (backend->impl && backend->impl->destroy) { backend->impl->destroy(backend); @@ -82,6 +86,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) { struct wlr_backend *wl_backend = attempt_wl_backend(display); if (wl_backend) { wlr_multi_backend_add(backend, wl_backend); + return backend; } } @@ -90,18 +95,25 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) { struct wlr_backend *x11_backend = wlr_x11_backend_create(display, x11_display); wlr_multi_backend_add(backend, x11_backend); + return backend; } // Attempt DRM+libinput struct wlr_session *session = wlr_session_create(display); if (!session) { wlr_log(L_ERROR, "Failed to start a DRM session"); - goto out; + wlr_backend_destroy(backend); + return NULL; } struct wlr_backend *libinput = wlr_libinput_backend_create(display, session); if (libinput) { wlr_multi_backend_add(backend, libinput); + } else { + wlr_log(L_ERROR, "Failed to start libinput backend"); + wlr_backend_destroy(backend); + wlr_session_destroy(session); + return NULL; } int gpus[8]; @@ -126,10 +138,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) { if (!primary_drm) { wlr_log(L_ERROR, "Failed to open any DRM device"); - } - -out: - if (wlr_multi_is_empty(backend)) { + wlr_backend_destroy(libinput); + wlr_session_destroy(session); wlr_backend_destroy(backend); return NULL; } |