Commit 00dbcd22 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

playlist: Proper locking when editing playlist variable in loadsave.c. Also...

playlist: Proper locking when editing playlist variable in loadsave.c. Also correctly release p_ml_onelevel->p_input and p_ml_category->p_input when changing them.

This fixes partly make check and input items leaks.
parent 6837b438
...@@ -148,19 +148,31 @@ int playlist_MLLoad( playlist_t *p_playlist ) ...@@ -148,19 +148,31 @@ int playlist_MLLoad( playlist_t *p_playlist )
if( p_input == NULL ) if( p_input == NULL )
goto error; goto error;
PL_LOCK;
if( p_playlist->p_ml_onelevel->p_input )
vlc_gc_decref( p_playlist->p_ml_onelevel->p_input );
if( p_playlist->p_ml_category->p_input )
vlc_gc_decref( p_playlist->p_ml_category->p_input );
p_playlist->p_ml_onelevel->p_input = p_playlist->p_ml_onelevel->p_input =
p_playlist->p_ml_category->p_input = p_input; p_playlist->p_ml_category->p_input = p_input;
vlc_gc_incref( p_input ); vlc_gc_incref( p_input );
PL_UNLOCK;
vlc_event_attach( &p_input->event_manager, vlc_InputItemSubItemAdded, vlc_event_attach( &p_input->event_manager, vlc_InputItemSubItemAdded,
input_item_subitem_added, p_playlist ); input_item_subitem_added, p_playlist );
PL_LOCK;
p_playlist->b_doing_ml = VLC_TRUE; p_playlist->b_doing_ml = VLC_TRUE;
PL_UNLOCK;
stats_TimerStart( p_playlist, "ML Load", STATS_TIMER_ML_LOAD ); stats_TimerStart( p_playlist, "ML Load", STATS_TIMER_ML_LOAD );
input_Read( p_playlist, p_input, VLC_TRUE ); input_Read( p_playlist, p_input, VLC_TRUE );
stats_TimerStop( p_playlist,STATS_TIMER_ML_LOAD ); stats_TimerStop( p_playlist,STATS_TIMER_ML_LOAD );
PL_LOCK;
p_playlist->b_doing_ml = VLC_FALSE; p_playlist->b_doing_ml = VLC_FALSE;
PL_UNLOCK;
vlc_event_detach( &p_input->event_manager, vlc_InputItemSubItemAdded, vlc_event_detach( &p_input->event_manager, vlc_InputItemSubItemAdded,
input_item_subitem_added, p_playlist ); input_item_subitem_added, p_playlist );
......
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