Bug 1648872 Comment 27 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Martin,

The problem seems to be that `wl_registry_bind` is static inline. The code from Wayland 1.10 creates a versioned proxy using `wl_proxy_marshal_constructor_versioned`. This version is replicated to other proxies created from this proxy (e.g. by `wl_proxy_marshal_constructor` in  `wl_compositor_create_surface` or `wl_proxy_create_wrapper` in Mesa).

But, the `wl_registry_bind` from from Wayland 1.6 creates the proxy using `wl_proxy_marshal_constructor`, which in Wayland 1.10 then copies `wl_registry`'s version instead of using the version from the arguments. This version is `0` and originally comes from `wl_display`:

```c
	/* We set this version to 0 for backwards compatibility.
	 *
	 * If a client is using old versions of protocol headers,
	 * it will use unversioned API to create proxies.  Those
	 * proxies will inherit this 0.
	 *
	 * A client could be passing these proxies into library
	 * code newer than the headers that checks proxy
	 * versions.  When the proxy version is reported as 0
	 * the library will know that it can't reliably determine
	 * the proxy version, and should do whatever fallback is
	 * required.
	 *
	 * This trick forces wl_display to always report 0, but
	 * since it's a special object that we can't bind
	 * specific versions of anyway, this should be fine.
	 */
	display->proxy.version = 0;
```
Martin,

The problem seems to be that `wl_registry_bind` is static inline. The code from Wayland 1.10 creates a versioned proxy using `wl_proxy_marshal_constructor_versioned`. This version is replicated to other proxies created from this proxy (e.g. by `wl_proxy_marshal_constructor` in  `wl_compositor_create_surface` or `wl_proxy_create_wrapper` in Mesa).

But, the `wl_registry_bind` from Wayland 1.6 creates the proxy using `wl_proxy_marshal_constructor`, which in Wayland 1.10 then copies `wl_registry`'s version instead of using the version from the arguments. This version is `0` and originally comes from `wl_display`:

```c
	/* We set this version to 0 for backwards compatibility.
	 *
	 * If a client is using old versions of protocol headers,
	 * it will use unversioned API to create proxies.  Those
	 * proxies will inherit this 0.
	 *
	 * A client could be passing these proxies into library
	 * code newer than the headers that checks proxy
	 * versions.  When the proxy version is reported as 0
	 * the library will know that it can't reliably determine
	 * the proxy version, and should do whatever fallback is
	 * required.
	 *
	 * This trick forces wl_display to always report 0, but
	 * since it's a special object that we can't bind
	 * specific versions of anyway, this should be fine.
	 */
	display->proxy.version = 0;
```

Back to Bug 1648872 Comment 27