From 5c382f6344718786842aaec0930010679cd61927 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 7 Oct 2022 18:15:24 +0200 Subject: drm-lease-v1: fix error codepath We were crashing in the error codepath [1] when wlr_drm_create_lease() fails. To fix this, delay the creation of the wlr_drm_lease_v1 until the request is granted. Previously we were allocating that struct early without populating the drm_lease field. However that means we ended up with a half-constructed struct in the error codepath which is annoying to handle. [1]: https://github.com/swaywm/sway/issues/7204#issuecomment-1269797356 --- include/wlr/types/wlr_drm_lease_v1.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_drm_lease_v1.h b/include/wlr/types/wlr_drm_lease_v1.h index 314eb8cc..4afa11e1 100644 --- a/include/wlr/types/wlr_drm_lease_v1.h +++ b/include/wlr/types/wlr_drm_lease_v1.h @@ -71,8 +71,7 @@ struct wlr_drm_lease_request_v1 { struct wlr_drm_lease_connector_v1 **connectors; size_t n_connectors; - /** NULL until the lease is submitted */ - struct wlr_drm_lease_v1 *lease; + struct wl_resource *lease_resource; bool invalid; -- cgit v1.2.3