[PATCH 2/2] wayland-server: Improve error messages for bad globals
Kristian Høgsberg
hoegsberg at gmail.com
Tue Nov 19 13:26:49 PST 2013
On Tue, Nov 12, 2013 at 09:44:37PM -0500, Jasper St. Pierre wrote:
> A bug in Weston's toytoolkit gave me an hour of debugging headaches.
> Improve the error messages that we send if a client requests an invalid
> global, either by name or by version.
That's a good improvement, applied.
Kristian
> ---
> src/wayland-server.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index d7c58b9..26fb84e 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -620,11 +620,15 @@ registry_bind(struct wl_client *client,
> if (global->name == name)
> break;
>
> - if (&global->link == &display->global_list ||
> - global->version < version)
> + if (&global->link == &display->global_list)
> wl_resource_post_error(resource,
> WL_DISPLAY_ERROR_INVALID_OBJECT,
> - "invalid global %d", name);
> + "invalid global %s (%d)", interface, name);
> + else if (global->version < version)
> + wl_resource_post_error(resource,
> + WL_DISPLAY_ERROR_INVALID_OBJECT,
> + "invalid version for global %s (%d): have %d, wanted %d",
> + interface, name, global->version, version);
> else
> global->bind(client, global->data, version, id);
> }
> --
> 1.8.4.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list