From dfab60c6eedcdbd0455ff0f85b4478ae807afee8 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 23 Jan 2022 09:27:08 +0100 Subject: [PATCH] clients/simple-dmabuf-feedback: fix bound global versions It's invalid for a client to pass the compositor's supported version directly to wl_registry_bind. For instance, under wlroots the client will bind to wl_output version 4 and crash because it doesn't handle the new "name" event. Signed-off-by: Simon Ser --- clients/simple-dmabuf-feedback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/simple-dmabuf-feedback.c b/clients/simple-dmabuf-feedback.c index 2fc940c3..dd2e64a5 100644 --- a/clients/simple-dmabuf-feedback.c +++ b/clients/simple-dmabuf-feedback.c @@ -1268,7 +1268,7 @@ registry_handle_global(void *data, struct wl_registry *registry, } else if (strcmp(interface, "wl_output") == 0) { d->output.wl_output = wl_registry_bind(registry, id, &wl_output_interface, - version); + MIN(version, 3)); wl_output_add_listener(d->output.wl_output, &output_listener, &d->output); } else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0) { @@ -1276,7 +1276,7 @@ registry_handle_global(void *data, struct wl_registry *registry, return; d->dmabuf = wl_registry_bind(registry, id, &zwp_linux_dmabuf_v1_interface, - version); + MIN(version, 4)); } }