From 1fc928d5280b77fdc19238225a64ad0585f8b723 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Thu, 12 Mar 2026 17:34:41 -0600 Subject: [PATCH] wlr_ext_image_copy_capture_v1: Fix crash when client creates a cursor session not implemented server side This guards against a crash where the server implements wlr_ext_image_capture_source_v1_interface without setting .get_pointer_cursor(). In general, we should install a NULL check here because this is a crash waiting to happen. Now, instead of crashing, the resource will be created and the copy capture session will be stopped. --- types/wlr_ext_image_copy_capture_v1.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/types/wlr_ext_image_copy_capture_v1.c b/types/wlr_ext_image_copy_capture_v1.c index c9e7b0079..2e969b4a9 100644 --- a/types/wlr_ext_image_copy_capture_v1.c +++ b/types/wlr_ext_image_copy_capture_v1.c @@ -518,14 +518,16 @@ static void cursor_session_handle_get_capture_session(struct wl_client *client, return; } - cursor_session->capture_session_created = true; - + struct wlr_ext_image_copy_capture_manager_v1 *manager = NULL; struct wlr_ext_image_capture_source_v1 *source = NULL; + if (cursor_session != NULL) { + manager = cursor_session->manager; + cursor_session->capture_session_created = true; source = &cursor_session->source->base; } - session_create(cursor_session_resource, new_id, source, 0, cursor_session->manager); + session_create(cursor_session_resource, new_id, source, 0, manager); } static const struct ext_image_copy_capture_cursor_session_v1_interface cursor_session_impl = {