/***********************************************************************
* Stop
***********************************************************************/
+static void ObjectKillChildrens( vlc_object_t *p_obj )
+{
+ vlc_list_t *p_list;
+ int i;
+ vlc_object_kill( p_obj );
+
+ p_list = vlc_list_children( p_obj );
+ for( i = 0; i < p_list->i_count; i++ )
+ ObjectKillChildrens( p_list->p_values[i].p_object );
+ vlc_list_release( p_list );
+}
+
void services_discovery_Stop ( services_discovery_t * p_sd )
{
- vlc_object_kill( p_sd );
+ ObjectKillChildrens( VLC_OBJECT(p_sd) );
if( p_sd->pf_run ) vlc_thread_join( p_sd );
module_Unneed( p_sd, p_sd->p_module );
input_item_t * p_input = p_event->u.services_discovery_item_added.p_new_item;
const char * psz_cat = p_event->u.services_discovery_item_added.psz_category;
playlist_item_t *p_new_item, * p_parent = user_data;
+ playlist_t * p_playlist = p_parent->p_playlist;
- msg_Dbg( p_parent->p_playlist, "Adding %s in %s",
+ msg_Dbg( p_playlist, "Adding %s in %s",
p_input->psz_name ? p_input->psz_name : "(null)",
psz_cat ? psz_cat : "(null)" );
+ PL_LOCK;
/* If p_parent is in root category (this is clearly a hack) and we have a cat */
if( !EMPTY_STR(psz_cat) &&
- p_parent->p_parent == p_parent->p_playlist->p_root_category )
+ p_parent->p_parent == p_playlist->p_root_category )
{
/* */
playlist_item_t * p_cat;
p_cat = playlist_ChildSearchName( p_parent, psz_cat );
if( !p_cat )
{
- p_cat = playlist_NodeCreate( p_parent->p_playlist, psz_cat,
+ p_cat = playlist_NodeCreate( p_playlist, psz_cat,
p_parent, 0, NULL );
p_cat->i_flags &= ~PLAYLIST_SKIP_FLAG;
}
p_parent = p_cat;
}
- p_new_item = playlist_NodeAddInput( p_parent->p_playlist, p_input, p_parent,
- PLAYLIST_APPEND, PLAYLIST_END, false );
+ p_new_item = playlist_NodeAddInput( p_playlist, p_input, p_parent,
+ PLAYLIST_APPEND, PLAYLIST_END, pl_Locked );
if( p_new_item )
{
p_new_item->i_flags &= ~PLAYLIST_SKIP_FLAG;
p_new_item->i_flags &= ~PLAYLIST_SAVE_FLAG;
}
+ PL_UNLOCK;
}
/* A new item has been removed from a certain sd */
vlc_object_unlock( p_parent->p_playlist );
return;
}
- vlc_object_unlock( p_parent->p_playlist );
/* Delete the non-node item normally */
- playlist_DeleteInputInParent( p_parent->p_playlist, p_input->i_id,
- p_parent, false );
+ playlist_DeleteFromInputInParent( p_parent->p_playlist, p_input->i_id,
+ p_parent, pl_Locked );
+
+ vlc_object_unlock( p_parent->p_playlist );
}
int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist, const char *psz_modules )