shm: fix resource versions

This was hardcoded to 1 regardless of the version passed to the
callback or the version of the parent resource.

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2023-11-21 16:57:31 +01:00 committed by Daniel Stone
parent 8072ab0a50
commit 9e233e31a2

View file

@ -310,6 +310,7 @@ shm_create_pool(struct wl_client *client, struct wl_resource *resource,
int seals;
int prot;
int flags;
uint32_t version;
if (size <= 0) {
wl_resource_post_error(resource,
@ -358,8 +359,10 @@ shm_create_pool(struct wl_client *client, struct wl_resource *resource,
#else
close(fd);
#endif
version = wl_resource_get_version(resource);
pool->resource =
wl_resource_create(client, &wl_shm_pool_interface, 1, id);
wl_resource_create(client, &wl_shm_pool_interface, version, id);
if (!pool->resource) {
wl_client_post_no_memory(client);
munmap(pool->data, pool->size);
@ -392,7 +395,7 @@ bind_shm(struct wl_client *client,
struct wl_array *additional_formats;
uint32_t *p;
resource = wl_resource_create(client, &wl_shm_interface, 1, id);
resource = wl_resource_create(client, &wl_shm_interface, version, id);
if (!resource) {
wl_client_post_no_memory(client);
return;