From 8f4dd4587e5e0619a799b255b85bed1ae557f14a Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 20 Jun 2012 19:03:33 +0100 Subject: [PATCH] onscreen: Free swap notify callback state When freeing a CoglOnscreen we weren't freeing the state associated with swap notification callbacks. Reviewed-by: Neil Roberts (cherry picked from commit 70bc12fe20fa1be4eac58356861a730f18d6b59e) --- cogl/cogl-onscreen.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c index ad8232cb7..4aaa5de4e 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;