Commit b1b63c31 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

No need to take the structure lock when finding oneself

as we don't go through the object table and links.
parent ef33cb40
...@@ -742,18 +742,15 @@ void * __vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode ) ...@@ -742,18 +742,15 @@ void * __vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode )
{ {
vlc_object_t *p_found; vlc_object_t *p_found;
vlc_mutex_lock( &structure_lock );
assert( vlc_internals( p_this )->i_refcount > 0 );
/* If we are of the requested type ourselves, don't look further */ /* If we are of the requested type ourselves, don't look further */
if( !(i_mode & FIND_STRICT) && p_this->i_object_type == i_type ) if( !(i_mode & FIND_STRICT) && p_this->i_object_type == i_type )
{ {
vlc_object_yield( p_this ); vlc_object_yield( p_this );
vlc_mutex_unlock( &structure_lock );
return p_this; return p_this;
} }
vlc_mutex_lock( &structure_lock );
/* Otherwise, recursively look for the object */ /* Otherwise, recursively look for the object */
if( (i_mode & 0x000f) == FIND_ANYWHERE ) if( (i_mode & 0x000f) == FIND_ANYWHERE )
{ {
...@@ -795,18 +792,17 @@ void * __vlc_object_find_name( vlc_object_t *p_this, const char *psz_name, ...@@ -795,18 +792,17 @@ void * __vlc_object_find_name( vlc_object_t *p_this, const char *psz_name,
{ {
vlc_object_t *p_found; vlc_object_t *p_found;
vlc_mutex_lock( &structure_lock );
/* If have the requested name ourselves, don't look further */ /* If have the requested name ourselves, don't look further */
if( !(i_mode & FIND_STRICT) if( !(i_mode & FIND_STRICT)
&& p_this->psz_object_name && p_this->psz_object_name
&& !strcmp( p_this->psz_object_name, psz_name ) ) && !strcmp( p_this->psz_object_name, psz_name ) )
{ {
vlc_object_yield( p_this ); vlc_object_yield( p_this );
vlc_mutex_unlock( &structure_lock );
return p_this; return p_this;
} }
vlc_mutex_lock( &structure_lock );
/* Otherwise, recursively look for the object */ /* Otherwise, recursively look for the object */
if( (i_mode & 0x000f) == FIND_ANYWHERE ) if( (i_mode & 0x000f) == FIND_ANYWHERE )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment