mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-16 05:34:23 -04:00
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.
This commit is contained in:
parent
3cb2cf9425
commit
1fc928d528
1 changed files with 5 additions and 3 deletions
|
|
@ -518,14 +518,16 @@ static void cursor_session_handle_get_capture_session(struct wl_client *client,
|
||||||
return;
|
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;
|
struct wlr_ext_image_capture_source_v1 *source = NULL;
|
||||||
|
|
||||||
if (cursor_session != NULL) {
|
if (cursor_session != NULL) {
|
||||||
|
manager = cursor_session->manager;
|
||||||
|
cursor_session->capture_session_created = true;
|
||||||
source = &cursor_session->source->base;
|
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 = {
|
static const struct ext_image_copy_capture_cursor_session_v1_interface cursor_session_impl = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue