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.
This commit is contained in:
Scott Anderson 2019-11-18 19:44:05 +13:00 committed by Simon Ser
parent 6c649bab53
commit b58e8451b8

View file

@ -297,22 +297,26 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
getenv("WAYLAND_SOCKET")) { getenv("WAYLAND_SOCKET")) {
struct wlr_backend *wl_backend = attempt_wl_backend(display, struct wlr_backend *wl_backend = attempt_wl_backend(display,
create_renderer_func); create_renderer_func);
if (wl_backend) { if (!wl_backend) {
goto error;
}
wlr_multi_backend_add(backend, wl_backend); wlr_multi_backend_add(backend, wl_backend);
return backend; return backend;
} }
}
#if WLR_HAS_X11_BACKEND #if WLR_HAS_X11_BACKEND
const char *x11_display = getenv("DISPLAY"); const char *x11_display = getenv("DISPLAY");
if (x11_display) { if (x11_display) {
struct wlr_backend *x11_backend = struct wlr_backend *x11_backend =
attempt_x11_backend(display, x11_display, create_renderer_func); attempt_x11_backend(display, x11_display, create_renderer_func);
if (x11_backend) { if (!x11_backend) {
goto error;
}
wlr_multi_backend_add(backend, x11_backend); wlr_multi_backend_add(backend, x11_backend);
return backend; return backend;
} }
}
#endif #endif
// Attempt DRM+libinput // Attempt DRM+libinput
@ -344,4 +348,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
} }
return backend; return backend;
error:
wlr_backend_destroy(backend);
return NULL;
} }