mirror of
https://gitlab.gnome.org/GNOME/libmks.git
synced 2025-04-14 08:27:16 +00:00
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().
This commit is contained in:
parent
a2525530ec
commit
93e2e70c7b
@ -106,21 +106,15 @@ mks_dmabuf_texture_data_new (GdkGLContext *gl_context,
|
|||||||
g_assert (GDK_IS_GL_CONTEXT (gl_context));
|
g_assert (GDK_IS_GL_CONTEXT (gl_context));
|
||||||
g_assert (texture_id > 0);
|
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->gl_context = g_object_ref (gl_context);
|
||||||
texture_data->texture_id = texture_id;
|
texture_data->texture_id = texture_id;
|
||||||
|
|
||||||
return texture_data;
|
return texture_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MksDmabufTextureData *
|
|
||||||
mks_dmabuf_texture_data_ref (MksDmabufTextureData *texture_data)
|
|
||||||
{
|
|
||||||
return g_atomic_rc_box_acquire (texture_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mks_dmabuf_texture_data_finalize (gpointer data)
|
mks_dmabuf_texture_data_free (gpointer data)
|
||||||
{
|
{
|
||||||
MksDmabufTextureData *texture_data = data;
|
MksDmabufTextureData *texture_data = data;
|
||||||
|
|
||||||
@ -129,16 +123,10 @@ mks_dmabuf_texture_data_finalize (gpointer data)
|
|||||||
|
|
||||||
texture_data->texture_id = 0;
|
texture_data->texture_id = 0;
|
||||||
g_clear_object (&texture_data->gl_context);
|
g_clear_object (&texture_data->gl_context);
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
g_free (texture_data);
|
||||||
mks_dmabuf_texture_data_unref (MksDmabufTextureData *texture_data)
|
|
||||||
{
|
|
||||||
g_atomic_rc_box_release_full (texture_data, mks_dmabuf_texture_data_finalize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MksDmabufTextureData, mks_dmabuf_texture_data_unref)
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mks_dmabuf_paintable_dispose (GObject *object)
|
mks_dmabuf_paintable_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -229,7 +217,7 @@ mks_dmabuf_paintable_import (MksDmabufPaintable *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
texture = gdk_gl_texture_builder_build (builder,
|
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));
|
mks_dmabuf_texture_data_new (gl_context, texture_id));
|
||||||
|
|
||||||
g_set_object (&self->texture, texture);
|
g_set_object (&self->texture, texture);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user