From 2f3591ace00cdf9944152fe98e11cc2e13282ce4 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 11 Apr 2013 12:40:51 +0100 Subject: [PATCH] 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 (cherry picked from commit 11683476a7a62cd14a10d84fd52f2cb4b47e33a0) --- examples/cogland.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/cogland.c b/examples/cogland.c index c18850a52..ca527deda 100644 --- a/examples/cogland.c +++ b/examples/cogland.c @@ -546,10 +546,13 @@ cogland_surface_commit (struct wl_client *client, wl_signal_add (&surface->buffer->resource.destroy_signal, &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.sy = 0; @@ -614,6 +617,9 @@ cogland_surface_free (CoglandSurface *surface) compositor->surfaces = g_list_remove (compositor->surfaces, 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, &surface->pending.frame_callback_list, link) wl_resource_destroy (&cb->resource);