mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
wayland: fix interface versioning
Add MIN(...) with the interface version actually implemented to all resource constructor, so that we never risk seeing requests we don't implement (and consequently segfault) https://bugzilla.gnome.org/show_bug.cgi?id=707851
This commit is contained in:
parent
95a9655412
commit
73ee491281
@ -871,7 +871,7 @@ bind_shell (struct wl_client *client,
|
||||
{
|
||||
struct wl_resource *resource;
|
||||
|
||||
resource = wl_resource_create (client, &wl_shell_interface, version, id);
|
||||
resource = wl_resource_create (client, &wl_shell_interface, MIN (1, version), id);
|
||||
wl_resource_set_implementation (resource, &meta_wayland_shell_interface, data, NULL);
|
||||
}
|
||||
|
||||
@ -973,7 +973,7 @@ bind_gtk_shell (struct wl_client *client,
|
||||
{
|
||||
struct wl_resource *resource;
|
||||
|
||||
resource = wl_resource_create (client, >k_shell_interface, version, id);
|
||||
resource = wl_resource_create (client, >k_shell_interface, MIN (1, version), id);
|
||||
wl_resource_set_implementation (resource, &meta_wayland_gtk_shell_interface, data, NULL);
|
||||
|
||||
/* FIXME: ask the plugin */
|
||||
|
@ -234,7 +234,7 @@ meta_wayland_compositor_create_surface (struct wl_client *wayland_client,
|
||||
surface = meta_wayland_surface_create (compositor,
|
||||
wayland_client,
|
||||
id,
|
||||
wl_resource_get_version (wayland_compositor_resource));
|
||||
MIN (3, wl_resource_get_version (wayland_compositor_resource)));
|
||||
|
||||
compositor->surfaces = g_list_prepend (compositor->surfaces, surface);
|
||||
}
|
||||
@ -297,7 +297,8 @@ meta_wayland_compositor_create_region (struct wl_client *wayland_client,
|
||||
MetaWaylandRegion *region = g_slice_new0 (MetaWaylandRegion);
|
||||
|
||||
region->resource = wl_resource_create (wayland_client,
|
||||
&wl_region_interface, 1,
|
||||
&wl_region_interface,
|
||||
MIN (1, wl_resource_get_version (compositor_resource)),
|
||||
id);
|
||||
wl_resource_set_implementation (region->resource,
|
||||
&meta_wayland_region_interface, region,
|
||||
@ -335,7 +336,7 @@ bind_output (struct wl_client *client,
|
||||
struct wl_resource *resource;
|
||||
guint mode_flags;
|
||||
|
||||
resource = wl_resource_create (client, &wl_output_interface, version, id);
|
||||
resource = wl_resource_create (client, &wl_output_interface, MIN (2, version), id);
|
||||
wayland_output->resources = g_list_prepend (wayland_output->resources, resource);
|
||||
|
||||
wl_resource_set_user_data (resource, wayland_output);
|
||||
@ -518,7 +519,7 @@ compositor_bind (struct wl_client *client,
|
||||
MetaWaylandCompositor *compositor = data;
|
||||
struct wl_resource *resource;
|
||||
|
||||
resource = wl_resource_create (client, &wl_compositor_interface, version, id);
|
||||
resource = wl_resource_create (client, &wl_compositor_interface, MIN (3, version), id);
|
||||
wl_resource_set_implementation (resource, &meta_wayland_compositor_interface, compositor, NULL);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ bind_xserver (struct wl_client *client,
|
||||
return;
|
||||
|
||||
compositor->xserver_resource =
|
||||
wl_resource_create (client, &xserver_interface, version, id);
|
||||
wl_resource_create (client, &xserver_interface, MIN (1, version), id);
|
||||
wl_resource_set_implementation (compositor->xserver_resource,
|
||||
&xserver_implementation, compositor, NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user