From f32f1fc7435e07cf555406822de756da269ebf74 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 29 Nov 2011 16:05:28 +0200 Subject: [PATCH] shell: forbid multiple wl_shell_surface objects Do not allow multiple wl_shell_surface objects to be created for a wl_surface object. Multiple shell_surface objects would confuse the compositor as they contain separate instances of the shell-private data. Signed-off-by: Pekka Paalanen --- compositor/shell.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compositor/shell.c b/compositor/shell.c index 98d5b3f9..fd2d4fca 100644 --- a/compositor/shell.c +++ b/compositor/shell.c @@ -410,6 +410,13 @@ shell_get_shell_surface(struct wl_client *client, struct wlsc_surface *surface = surface_resource->data; struct shell_surface *shsurf; + if (get_shell_surface(surface)) { + wl_resource_post_error(surface_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "wl_shell::get_shell_surface already requested"); + return; + } + shsurf = calloc(1, sizeof *shsurf); if (!shsurf) { wl_resource_post_no_memory(resource);