From beb9a9ad0a38867154b7606911c33ffa5ecf759f Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Wed, 28 Aug 2024 18:10:10 +0200 Subject: [PATCH] linux-drm-syncobj-v1: Skip release if there is no timeline If a surface with an existing buffer has a syncobj surface state created without committing a new buffer with associated timelines, callers will see the surface as having a syncobj state and may try to use it, but calling the signal_release_with_buffer helper at this time will assert on the lacking release timeline. As this is a valid situation, remove the assert and replace it with an early return so that callers do not need to explicitly check for the presence of valid timelines. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3895 --- types/wlr_linux_drm_syncobj_v1.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/wlr_linux_drm_syncobj_v1.c b/types/wlr_linux_drm_syncobj_v1.c index c2e339a4..0713bcce 100644 --- a/types/wlr_linux_drm_syncobj_v1.c +++ b/types/wlr_linux_drm_syncobj_v1.c @@ -492,7 +492,12 @@ static void release_signaller_handle_buffer_release(struct wl_listener *listener bool wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer( struct wlr_linux_drm_syncobj_surface_v1_state *state, struct wlr_buffer *buffer) { assert(buffer->n_locks > 0); - assert(state->release_timeline != NULL); + if (state->release_timeline == NULL) { + // This can happen if an existing surface with a buffer has a + // syncobj_surface_v1_state created but no new buffer with release + // timeline committed. + return true; + } struct release_signaller *signaller = calloc(1, sizeof(*signaller)); if (signaller == NULL) {