vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Feb 27 19:27:38 2019 +0200| [88dfced1d37de0df15f986a223339cafd9e0e250] | committer: Rémi Denis-Courmont
objects: privatize the parent pointer > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=88dfced1d37de0df15f986a223339cafd9e0e250 --- include/vlc_objects.h | 7 ------- src/misc/objects.c | 8 ++++---- src/misc/variables.h | 1 + 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/vlc_objects.h b/include/vlc_objects.h index 582dd7eafa..49833962e8 100644 --- a/include/vlc_objects.h +++ b/include/vlc_objects.h @@ -49,13 +49,6 @@ struct vlc_common_members * See \ref module_need(). */ bool force; - - /** Parent object - * - * The parent VLC object in the objects tree. For the root (the LibVLC - * instance) object, this is NULL. - */ - vlc_object_t *parent; }; /** diff --git a/src/misc/objects.c b/src/misc/objects.c index fb8c2adec9..192999e257 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -224,7 +224,7 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length, obj->obj.no_interact = parent->obj.no_interact; /* Attach the child to its parent (no lock needed) */ - obj->obj.parent = vlc_object_hold (parent); + priv->parent = vlc_object_hold(parent); /* Attach the parent to its child (structure lock needed) */ vlc_mutex_lock (&papriv->tree_lock); @@ -234,7 +234,7 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length, else { obj->obj.no_interact = false; - obj->obj.parent = NULL; + priv->parent = NULL; /* TODO: should be in src/libvlc.c */ int canc = vlc_savecancel (); @@ -285,7 +285,7 @@ const char *vlc_object_typename(const vlc_object_t *obj) vlc_object_t *(vlc_object_parent)(vlc_object_t *obj) { - return obj->obj.parent; + return vlc_internals(obj)->parent; } static vlc_mutex_t name_lock = VLC_STATIC_MUTEX; @@ -333,7 +333,7 @@ static void vlc_object_destroy( vlc_object_t *p_this ) if( p_priv->pf_destructor ) p_priv->pf_destructor( p_this ); - if (unlikely(p_this->obj.parent == NULL)) + if (unlikely(p_priv->parent == NULL)) { /* TODO: should be in src/libvlc.c */ var_DelCallback (p_this, "vars", VarsCommand, NULL); diff --git a/src/misc/variables.h b/src/misc/variables.h index 3e049480ad..b514c0807f 100644 --- a/src/misc/variables.h +++ b/src/misc/variables.h @@ -37,6 +37,7 @@ typedef struct vlc_object_internals vlc_object_internals_t; struct vlc_object_internals { alignas (max_align_t) /* ensure vlc_externals() is maximally aligned */ + vlc_object_t *parent; /**< Parent object (or NULL) */ const char *typename; /**< Object type human-readable name */ char *psz_name; /* given name */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
