[Cogl] [PATCH] onscreen: Free swap notify callback state

Robert Bragg robert at sixbynine.org
Wed Jun 20 11:23:57 PDT 2012


From: Robert Bragg <robert at linux.intel.com>

When freeing a CoglOnscreen we weren't freeing the state associated with
swap notification callbacks.
---
 cogl/cogl-onscreen.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c
index dda7d4c..a7a50e3 100644
--- a/cogl/cogl-onscreen.c
+++ b/cogl/cogl-onscreen.c
@@ -115,6 +115,7 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
   CoglResizeNotifyEntry *resize_entry;
+  CoglSwapBuffersNotifyEntry *swap_entry;
 
   while ((resize_entry = COGL_TAILQ_FIRST (&onscreen->resize_callbacks)))
     {
@@ -122,6 +123,12 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
       g_slice_free (CoglResizeNotifyEntry, resize_entry);
     }
 
+  while ((swap_entry = COGL_TAILQ_FIRST (&onscreen->swap_callbacks)))
+    {
+      COGL_TAILQ_REMOVE (&onscreen->swap_callbacks, swap_entry, list_node);
+      g_slice_free (CoglSwapBuffersNotifyEntry, swap_entry);
+    }
+
   if (framebuffer->context->window_buffer == COGL_FRAMEBUFFER (onscreen))
     framebuffer->context->window_buffer = NULL;
 
-- 
1.7.7.6



More information about the Cogl mailing list