[vlc-devel] commit: 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. (Pierre d'Herbemont )
Pierre d'Herbemont
pdherbemont at free.fr
Tue Apr 1 02:16:07 CEST 2008
On Apr 1, 2008, at 2:02 AM, Enrique Osuna wrote:
> I might be speaking out of line here, but why decref potentially twice
> on the same object:
>
> + 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 );
>
> when you only incref once:
>
> p_playlist->p_ml_onelevel->p_input =
> p_playlist->p_ml_category->p_input = p_input;
> vlc_gc_incref( p_input );
>
Actually strictly speaking of refcount, it's fine because the p_input
already has a refcount at 1 after creation, and we never decref it, so
in the end that p_input has a refcount of 2, which is what we want,
But...
>
... we should keep a ref around for the rest of the function, else
there could be a race.
Hence, I committed a fix ;)
Thanks for the review. There was effectively a problem with
refcounting in this commit.
Pierre.
More information about the vlc-devel
mailing list