From cec68590283dd7f9905695c8f52dc7d93d8f2350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 24 Jul 2019 16:45:15 +0200 Subject: [PATCH 05/28] cogl/framebuffer: Unref the config swap chain if set When initializing an onscreen through _cogl_onscreen_init_from_template, we set the framebuffer config swap_chain and ref it. However we don't unref it on destruction. So, unref it if set when freeing the framebuffer https://gitlab.gnome.org/GNOME/mutter/merge_requests/682 --- cogl/cogl/cogl-framebuffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index 6b105087d..3a107a2e2 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -168,60 +168,63 @@ _cogl_framebuffer_init (CoglFramebuffer *framebuffer, ctx->framebuffers = g_list_prepend (ctx->framebuffers, framebuffer); } void _cogl_framebuffer_set_internal_format (CoglFramebuffer *framebuffer, CoglPixelFormat internal_format) { framebuffer->internal_format = internal_format; } void _cogl_framebuffer_free (CoglFramebuffer *framebuffer) { CoglContext *ctx = framebuffer->context; _cogl_fence_cancel_fences_for_framebuffer (framebuffer); _cogl_clip_stack_unref (framebuffer->clip_stack); cogl_object_unref (framebuffer->modelview_stack); framebuffer->modelview_stack = NULL; cogl_object_unref (framebuffer->projection_stack); framebuffer->projection_stack = NULL; cogl_object_unref (framebuffer->journal); if (ctx->viewport_scissor_workaround_framebuffer == framebuffer) ctx->viewport_scissor_workaround_framebuffer = NULL; + if (framebuffer->config.swap_chain) + cogl_object_unref (framebuffer->config.swap_chain); + ctx->framebuffers = g_list_remove (ctx->framebuffers, framebuffer); if (ctx->current_draw_buffer == framebuffer) ctx->current_draw_buffer = NULL; if (ctx->current_read_buffer == framebuffer) ctx->current_read_buffer = NULL; } const CoglWinsysVtable * _cogl_framebuffer_get_winsys (CoglFramebuffer *framebuffer) { return framebuffer->context->display->renderer->winsys_vtable; } /* This version of cogl_clear can be used internally as an alternative * to avoid flushing the journal or the framebuffer state. This is * needed when doing operations that may be called whiling flushing * the journal */ void _cogl_framebuffer_clear_without_flush4f (CoglFramebuffer *framebuffer, unsigned long buffers, float red, float green, float blue, float alpha) { CoglContext *ctx = framebuffer->context; if (!buffers) { -- 2.26.2