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

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