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 <contact@emersion.fr>
This commit is contained in:
Simon Ser 2022-01-23 09:27:08 +01:00 committed by Daniel Stone
parent 4ac64883d8
commit dfab60c6ee

View file

@ -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));
}
}