renderer-native: Don't leak DMA buffer CoglFramebuffer

When we created the DMA buffer backed CoglFramebuffer, we handed it over
to CoglDmaBufHandle which took its own reference. What we failed to do
was to release our own reference to it, effectively leaking it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283
This commit is contained in:
Jonas Ådahl 2020-06-02 18:34:57 +02:00
parent 97175f8fa1
commit c823b5ddba

View File

@ -2168,6 +2168,7 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
case META_RENDERER_NATIVE_MODE_GBM: case META_RENDERER_NATIVE_MODE_GBM:
{ {
CoglFramebuffer *dmabuf_fb; CoglFramebuffer *dmabuf_fb;
CoglDmaBufHandle *dmabuf_handle;
struct gbm_bo *new_bo; struct gbm_bo *new_bo;
int stride; int stride;
int offset; int offset;
@ -2210,10 +2211,13 @@ meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
if (!dmabuf_fb) if (!dmabuf_fb)
return NULL; return NULL;
return cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd, dmabuf_handle =
cogl_dma_buf_handle_new (dmabuf_fb, dmabuf_fd,
width, height, stride, offset, bpp, width, height, stride, offset, bpp,
new_bo, new_bo,
(GDestroyNotify) gbm_bo_destroy); (GDestroyNotify) gbm_bo_destroy);
cogl_object_unref (dmabuf_fb);
return dmabuf_handle;
} }
break; break;
#ifdef HAVE_EGL_DEVICE #ifdef HAVE_EGL_DEVICE