Skip to content
Snippets Groups Projects
Commit baa8f6b1 authored by Daniel Stone's avatar Daniel Stone
Browse files

xdg-shell: Move check for surface having buffer earlier


It's illegal to create an xdg_surface for a surface which already has a
buffer attached to it. We check for this, but only after we've created
our weston_desktop_surface; this simply avoids creating the internal
tracking structure when we're only going to destroy it after posting the
error.

Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
parent 6f6fd268
No related branches found
No related tags found
2 merge requests!905color-lcms: Introduction and implementation of LCMS plugin,!627Fail xdg_surface creation when surface has role
......@@ -1422,6 +1422,13 @@ weston_desktop_xdg_shell_protocol_get_xdg_surface(struct wl_client *wl_client,
wl_resource_get_user_data(surface_resource);
struct weston_desktop_xdg_surface *surface;
if (wsurface->buffer_ref.buffer != NULL) {
wl_resource_post_error(resource,
XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
"xdg_surface must not have a buffer at creation");
return;
}
surface = zalloc(weston_desktop_surface_role_biggest_size);
if (surface == NULL) {
wl_client_post_no_memory(wl_client);
......@@ -1449,13 +1456,6 @@ weston_desktop_xdg_shell_protocol_get_xdg_surface(struct wl_client *wl_client,
id, weston_desktop_xdg_surface_resource_destroy);
if (surface->resource == NULL)
return;
if (wsurface->buffer_ref.buffer != NULL) {
wl_resource_post_error(surface->resource,
XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
"xdg_surface must not have a buffer at creation");
return;
}
}
static void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment