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.

(cherry picked from commit 1fc928d528)
This commit is contained in:
Scott Moreau 2026-03-12 17:34:41 -06:00 committed by Simon Ser
parent ba32abbddb
commit 47a43e14ae

View file

@ -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 = {