Blame SOURCES/0005-cogl-framebuffer-Unref-the-config-swap-chain-if-set.patch

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