Blame SOURCES/0002-renderer-native-Don-t-leak-DMA-buffer-CoglFramebuffe.patch

f15b50
From 2e4d3e22aff7cc8e41fa08d798c55a39a542476c Mon Sep 17 00:00:00 2001
f15b50
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
f15b50
Date: Tue, 2 Jun 2020 18:34:57 +0200
f15b50
Subject: [PATCH 2/2] renderer-native: Don't leak DMA buffer CoglFramebuffer
f15b50
f15b50
When we created the DMA buffer backed CoglFramebuffer, we handed it over
f15b50
to CoglDmaBufHandle which took its own reference. What we failed to do
f15b50
was to release our own reference to it, effectively leaking it.
f15b50
f15b50
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283
f15b50
(cherry picked from commit c823b5ddba18d30e1fdb74d6764cd40637dc4054)
f15b50
---
f15b50
 src/backends/native/meta-renderer-native.c | 8 ++++++--
f15b50
 1 file changed, 6 insertions(+), 2 deletions(-)
f15b50
f15b50
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
f15b50
index ba98de650..dbb88edb8 100644
f15b50
--- a/src/backends/native/meta-renderer-native.c
f15b50
+++ b/src/backends/native/meta-renderer-native.c
f15b50
@@ -2633,6 +2633,7 @@ meta_renderer_native_create_dma_buf (CoglRenderer  *cogl_renderer,
f15b50
     case META_RENDERER_NATIVE_MODE_GBM:
f15b50
       {
f15b50
         CoglFramebuffer *dmabuf_fb;
f15b50
+        CoglDmaBufHandle *dmabuf_handle;
f15b50
         struct gbm_bo *new_bo;
f15b50
         int dmabuf_fd = -1;
f15b50
 
f15b50
@@ -2669,8 +2670,11 @@ meta_renderer_native_create_dma_buf (CoglRenderer  *cogl_renderer,
f15b50
         if (!dmabuf_fb)
f15b50
           return NULL;
f15b50
 
f15b50
-        return cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo,
f15b50
-                                        (GDestroyNotify) gbm_bo_destroy);
f15b50
+        dmabuf_handle =
f15b50
+          cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, new_bo,
f15b50
+                                   (GDestroyNotify) gbm_bo_destroy);
f15b50
+        cogl_object_unref (dmabuf_fb);
f15b50
+        return dmabuf_handle;
f15b50
       }
f15b50
       break;
f15b50
 #ifdef HAVE_EGL_DEVICE
f15b50
-- 
f15b50
2.26.2
f15b50