compositor: allow multiple input_device_attach()'s with a nil buffer

Without this change, weston would crash whenever a nil buffer was
passed to input_device_attach() if the cursor sprite was not mapped.
While at it, change the unmapping code to use weston_surface_unmap().
This commit is contained in:
Ander Conselvan de Oliveira
2012-03-16 17:25:10 +02:00
committed by Kristian Høgsberg
parent e2d21e82fc
commit 96b0abd88a
+3 -4
View File
@@ -1831,10 +1831,9 @@ input_device_attach(struct wl_client *client,
if (device->input_device.pointer_focus->resource.client != client) if (device->input_device.pointer_focus->resource.client != client)
return; return;
if (!buffer_resource && device->sprite->output) { if (!buffer_resource) {
wl_list_remove(&device->sprite->link); if (device->sprite->output)
wl_list_remove(&device->sprite->layer_link); weston_surface_unmap(device->sprite);
device->sprite->output = NULL;
return; return;
} }