[mutter] wayland/dma-buf: Handle getting dma-buf from detached buffer handle



commit 4b1805c3065eea293aefb1e3d1dc0ba685bcc1fc
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Sep 13 17:30:11 2019 +0200

    wayland/dma-buf: Handle getting dma-buf from detached buffer handle
    
    We might still have a MetaWaylandBuffer for a wl_buffer that was
    destroyed. Handle trying to fetch the MetaWaylandDmaBufBuffer from such
    a buffer gracefully.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/798

 src/wayland/meta-wayland-dma-buf.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c
index 0ac231a30..e50389aec 100644
--- a/src/wayland/meta-wayland-dma-buf.c
+++ b/src/wayland/meta-wayland-dma-buf.c
@@ -282,6 +282,9 @@ static const struct wl_buffer_interface dma_buf_buffer_impl =
 MetaWaylandDmaBufBuffer *
 meta_wayland_dma_buf_from_buffer (MetaWaylandBuffer *buffer)
 {
+  if (!buffer->resource)
+    return NULL;
+
   if (wl_resource_instance_of (buffer->resource, &wl_buffer_interface,
                                &dma_buf_buffer_impl))
     return wl_resource_get_user_data (buffer->resource);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]