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().
if (device->input_device.pointer_focus->resource.client != client)
return;
- if (!buffer_resource && device->sprite->output) {
- wl_list_remove(&device->sprite->link);
- wl_list_remove(&device->sprite->layer_link);
- device->sprite->output = NULL;
+ if (!buffer_resource) {
+ if (device->sprite->output)
+ weston_surface_unmap(device->sprite);
return;
}