[cogl/cogl-1.14] cogland: Fix handling the destroy listener for the pending buffer



commit 2f3591ace00cdf9944152fe98e11cc2e13282ce4
Author: Neil Roberts <neil linux intel com>
Date:   Thu Apr 11 12:40:51 2013 +0100

    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)

 examples/cogland.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/examples/cogland.c b/examples/cogland.c
index c18850a..ca527de 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]