mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
mini-object: use ref/unref directly in boxed copy/free
GLib will not call our copy/free with a NULL object
This commit is contained in:
parent
5cf8e68944
commit
1e59b651ba
1 changed files with 2 additions and 20 deletions
|
@ -48,24 +48,6 @@ static GstAllocTrace *_gst_mini_object_trace;
|
|||
/* Mutex used for weak referencing */
|
||||
G_LOCK_DEFINE_STATIC (weak_refs_mutex);
|
||||
|
||||
/* boxed copy and free functions. Don't real copy or free but simply
|
||||
* change the refcount */
|
||||
static GstMiniObject *
|
||||
_gst_mini_object_boxed_copy (GstMiniObject * mini_object)
|
||||
{
|
||||
if (mini_object)
|
||||
return gst_mini_object_ref (mini_object);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_gst_mini_object_boxed_free (GstMiniObject * mini_object)
|
||||
{
|
||||
if (mini_object)
|
||||
gst_mini_object_unref (mini_object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_mini_object_register:
|
||||
* @name: name of the new boxed type
|
||||
|
@ -84,8 +66,8 @@ gst_mini_object_register (const gchar * name)
|
|||
g_return_val_if_fail (name != NULL, 0);
|
||||
|
||||
type = g_boxed_type_register_static (name,
|
||||
(GBoxedCopyFunc) _gst_mini_object_boxed_copy,
|
||||
(GBoxedFreeFunc) _gst_mini_object_boxed_free);
|
||||
(GBoxedCopyFunc) gst_mini_object_ref,
|
||||
(GBoxedFreeFunc) gst_mini_object_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue