shell: Do not hang after setting input_panel twice

Ignore multiple calls with the same surface in input_panel_set_surface.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
This commit is contained in:
Jan Arne Petersen 2013-01-16 21:26:54 +01:00 committed by Kristian Høgsberg
parent af7b6c9c6d
commit 23ccfb3ef9

View File

@ -3309,6 +3309,14 @@ input_panel_set_surface(struct wl_client *client,
surface->private = shell; surface->private = shell;
surface->output = output; surface->output = output;
/* Do not do anything when surface is already in the list of
* input panel surfaces
*/
wl_list_for_each(input_panel_surface, &shell->input_panel.surfaces, link) {
if (input_panel_surface->surface == surface)
return;
}
input_panel_surface = malloc(sizeof *input_panel_surface); input_panel_surface = malloc(sizeof *input_panel_surface);
if (!input_panel_surface) { if (!input_panel_surface) {
wl_resource_post_no_memory(resource); wl_resource_post_no_memory(resource);