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;