From d6f9cfc1595befd5de58ebe8d86da7d75f3a2ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 30 Sep 2020 15:54:18 +0200 Subject: [PATCH] va: allocator: user gst_clear_object() for _buffer_surface_unref() Event if this function is only used by gst_va_dmabuf_memories_setup(), it might get reused later by GstVaDmabufAllocator's functions. This change makes the function less fragile. Part-of: --- sys/va/gstvaallocator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/va/gstvaallocator.c b/sys/va/gstvaallocator.c index 3974698238..89450ca58b 100644 --- a/sys/va/gstvaallocator.c +++ b/sys/va/gstvaallocator.c @@ -438,7 +438,7 @@ _buffer_surface_unref (gpointer data) if (g_atomic_int_dec_and_test (&buf->ref_count)) { GST_LOG_OBJECT (buf->display, "Destroying surface %#x", buf->surface); _destroy_surfaces (buf->display, &buf->surface, 1); - gst_object_unref (buf->display); + gst_clear_object (&buf->display); g_slice_free (GstVaBufferSurface, buf); } } @@ -451,6 +451,7 @@ _create_buffer_surface (VASurfaceID surface, GstVideoFormat format, g_atomic_int_set (&buf->ref_count, 0); buf->surface = surface; + buf->display = NULL; gst_video_info_set_format (&buf->info, format, width, height); return buf;