[vlc-commits] objects: inline vlc_object_destroy()
Rémi Denis-Courmont
git at videolan.org
Sun Mar 17 02:39:19 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar 17 03:25:16 2019 +0200| [b18fb9ed518d9d16b7cfbee6fd1711ef3b8f98d4] | committer: Rémi Denis-Courmont
objects: inline vlc_object_destroy()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b18fb9ed518d9d16b7cfbee6fd1711ef3b8f98d4
---
src/misc/objects.c | 29 +++++++----------------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/src/misc/objects.c b/src/misc/objects.c
index 0f66fdae99..e0345b4d99 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -238,10 +238,7 @@ vlc_object_t *(vlc_object_parent)(vlc_object_t *obj)
return vlc_internals(obj)->parent;
}
-/**
- * Destroys a VLC object once it has no more references.
- */
-static void vlc_object_destroy(vlc_object_t *obj)
+void (vlc_object_delete)(vlc_object_t *obj)
{
vlc_object_internals_t *priv = vlc_internals(obj);
@@ -258,6 +255,12 @@ static void vlc_object_destroy(vlc_object_t *obj)
/* TODO: should be in src/libvlc.c */
var_DelCallback(obj, "tree", TreeCommand, NULL);
}
+ else
+ {
+ vlc_mutex_lock(&tree_lock);
+ vlc_list_remove(&priv->list);
+ vlc_mutex_unlock(&tree_lock);
+ }
/* Destroy the associated variables. */
var_DestroyAll(obj);
@@ -289,24 +292,6 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this, const char *psz_name )
return NULL;
}
-void (vlc_object_delete)(vlc_object_t *obj)
-{
- vlc_object_internals_t *priv = vlc_internals(obj);
- vlc_object_t *parent = vlc_object_parent(obj);
-
- if (unlikely(parent == NULL))
- { /* Destroying the root object */
- vlc_object_destroy (obj);
- return;
- }
-
- vlc_mutex_lock(&tree_lock);
- /* Detach from parent to protect against vlc_object_find_name() */
- vlc_list_remove(&priv->list);
- vlc_mutex_unlock(&tree_lock);
- vlc_object_destroy (obj);
-}
-
void vlc_object_vaLog(vlc_object_t *obj, int prio, const char *module,
const char *file, unsigned line, const char *func,
const char *format, va_list ap)
More information about the vlc-commits
mailing list