mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/headless: dup DRM FD in wlr_headless_backend_create_with_renderer
We were not dup'ing the DRM FD coming from wlr_renderer_get_drm_fd, resulting in a double-close on backend destroy.
This commit is contained in:
parent
a1e8a639b3
commit
c85789a3a9
1 changed files with 9 additions and 3 deletions
|
@ -248,9 +248,15 @@ struct wlr_backend *wlr_headless_backend_create_with_renderer(
|
|||
}
|
||||
backend->has_parent_renderer = true;
|
||||
|
||||
backend->drm_fd = wlr_renderer_get_drm_fd(renderer);
|
||||
if (backend->drm_fd < 0) {
|
||||
wlr_log(WLR_ERROR, "Failed to get DRM device FD from renderer");
|
||||
int drm_fd = wlr_renderer_get_drm_fd(renderer);
|
||||
if (drm_fd < 0) {
|
||||
wlr_log(WLR_ERROR, "Failed to get DRM device FD from parent renderer");
|
||||
backend->drm_fd = -1;
|
||||
} else {
|
||||
backend->drm_fd = fcntl(drm_fd, F_DUPFD_CLOEXEC, 0);
|
||||
if (backend->drm_fd < 0) {
|
||||
wlr_log_errno(WLR_ERROR, "fcntl(F_DUPFD_CLOEXEC) failed");
|
||||
}
|
||||
}
|
||||
|
||||
if (!backend_init(backend, display, renderer)) {
|
||||
|
|
Loading…
Reference in a new issue