From 93e2e70c7b9e0af4d016ad503c496f47e09856ba Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 2 Jun 2023 10:23:31 -0700 Subject: [PATCH] dmabuf-paintable: remove use of arc box There is only a single unref of this, via the GdkGLTexture so just use a free function and g_new0()/g_free(). --- lib/mks-dmabuf-paintable.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/mks-dmabuf-paintable.c b/lib/mks-dmabuf-paintable.c index 816294d..5131ffe 100644 --- a/lib/mks-dmabuf-paintable.c +++ b/lib/mks-dmabuf-paintable.c @@ -106,21 +106,15 @@ mks_dmabuf_texture_data_new (GdkGLContext *gl_context, g_assert (GDK_IS_GL_CONTEXT (gl_context)); g_assert (texture_id > 0); - texture_data = g_atomic_rc_box_new0 (MksDmabufTextureData); + texture_data = g_new0 (MksDmabufTextureData, 1); texture_data->gl_context = g_object_ref (gl_context); texture_data->texture_id = texture_id; return texture_data; } -static MksDmabufTextureData * -mks_dmabuf_texture_data_ref (MksDmabufTextureData *texture_data) -{ - return g_atomic_rc_box_acquire (texture_data); -} - static void -mks_dmabuf_texture_data_finalize (gpointer data) +mks_dmabuf_texture_data_free (gpointer data) { MksDmabufTextureData *texture_data = data; @@ -129,16 +123,10 @@ mks_dmabuf_texture_data_finalize (gpointer data) texture_data->texture_id = 0; g_clear_object (&texture_data->gl_context); -} -static void -mks_dmabuf_texture_data_unref (MksDmabufTextureData *texture_data) -{ - g_atomic_rc_box_release_full (texture_data, mks_dmabuf_texture_data_finalize); + g_free (texture_data); } -G_DEFINE_AUTOPTR_CLEANUP_FUNC (MksDmabufTextureData, mks_dmabuf_texture_data_unref) - static void mks_dmabuf_paintable_dispose (GObject *object) { @@ -229,7 +217,7 @@ mks_dmabuf_paintable_import (MksDmabufPaintable *self, } texture = gdk_gl_texture_builder_build (builder, - (GDestroyNotify)mks_dmabuf_texture_data_unref, + mks_dmabuf_texture_data_free, mks_dmabuf_texture_data_new (gl_context, texture_id)); g_set_object (&self->texture, texture);