aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Anderson <scott@anderso.nz>2019-11-18 19:44:05 +1300
committerSimon Ser <contact@emersion.fr>2019-11-18 11:53:17 +0100
commitb58e8451b8e5b301d845a5191438ceede12ef411 (patch)
treed8a875d8850d605df3686fc4bf866b1751cb0ce2
parent6c649bab537f75ebf4def87be2a59c860bcc6859 (diff)
backend: Do not attempt DRM on X11/WL failure
This can really mess with the session if logind is not being used, and it's going to always fail anyway.
-rw-r--r--backend/backend.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 542d6f80..bb75c5e0 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -297,10 +297,12 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
getenv("WAYLAND_SOCKET")) {
struct wlr_backend *wl_backend = attempt_wl_backend(display,
create_renderer_func);
- if (wl_backend) {
- wlr_multi_backend_add(backend, wl_backend);
- return backend;
+ if (!wl_backend) {
+ goto error;
}
+
+ wlr_multi_backend_add(backend, wl_backend);
+ return backend;
}
#if WLR_HAS_X11_BACKEND
@@ -308,10 +310,12 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
if (x11_display) {
struct wlr_backend *x11_backend =
attempt_x11_backend(display, x11_display, create_renderer_func);
- if (x11_backend) {
- wlr_multi_backend_add(backend, x11_backend);
- return backend;
+ if (!x11_backend) {
+ goto error;
}
+
+ wlr_multi_backend_add(backend, x11_backend);
+ return backend;
}
#endif
@@ -344,4 +348,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
}
return backend;
+
+error:
+ wlr_backend_destroy(backend);
+ return NULL;
}