cogland: Fix handling the destroy listener for the pending buffer

The handler for the destroy signal on the pending buffer was not
correctly being removed if the same buffer is committed twice to the
surface. It was also not being cleared if the surface is destroyed
before the pending buffer is committed.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 11683476a7a62cd14a10d84fd52f2cb4b47e33a0)
This commit is contained in:
Neil Roberts 2013-04-11 12:40:51 +01:00
parent a2168cedb3
commit 2f3591ace0

View File

@ -546,10 +546,13 @@ cogland_surface_commit (struct wl_client *client,
wl_signal_add (&surface->buffer->resource.destroy_signal, wl_signal_add (&surface->buffer->resource.destroy_signal,
&surface->buffer_destroy_listener); &surface->buffer_destroy_listener);
wl_list_remove (&surface->pending.buffer_destroy_listener.link);
} }
} }
surface->pending.buffer = NULL; if (surface->pending.buffer)
{
wl_list_remove (&surface->pending.buffer_destroy_listener.link);
surface->pending.buffer = NULL;
}
surface->pending.sx = 0; surface->pending.sx = 0;
surface->pending.sy = 0; surface->pending.sy = 0;
@ -614,6 +617,9 @@ cogland_surface_free (CoglandSurface *surface)
compositor->surfaces = g_list_remove (compositor->surfaces, surface); compositor->surfaces = g_list_remove (compositor->surfaces, surface);
cogland_surface_detach_buffer_and_notify (surface); cogland_surface_detach_buffer_and_notify (surface);
if (surface->pending.buffer)
wl_list_remove (&surface->pending.buffer_destroy_listener.link);
wl_list_for_each_safe (cb, next, wl_list_for_each_safe (cb, next,
&surface->pending.frame_callback_list, link) &surface->pending.frame_callback_list, link)
wl_resource_destroy (&cb->resource); wl_resource_destroy (&cb->resource);