[vlc-devel] possible threading issue in libvlc_media_player_get_media

Sergey Radionov rsatom at gmail.com
Sat Apr 5 15:53:50 CEST 2014


Hello.
I think it's a bug, but don't sure:
http://git.videolan.org/?p=vlc.git;a=blob;f=lib/media_player.c;h=8eee79c7c1406916e81d3e87d48f7b8240a9e9f3;hb=HEAD#l686

686
/**************************************************************************
687  * Get the Media descriptor associated with the instance.
688
**************************************************************************/
689 libvlc_media_t *
690 libvlc_media_player_get_media( libvlc_media_player_t *p_mi )
691 {
692     libvlc_media_t *p_m;
693
694     lock(p_mi);
695     p_m = p_mi->p_md;
696     if( p_m )
697         libvlc_media_retain( p_mi->p_md );
698     unlock(p_mi);
699     return p_mi->p_md;
700 }

Should p_m be returned instead of p_mi->p_md?
Since unlock was done already, and p_mi->p_md could be changed between
unlock(p_mi);
and
return p_mi->p_md;

Or am I missed something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20140405/e6813da9/attachment.html>


More information about the vlc-devel mailing list