[vlc-devel] commit: libvlc: ref_count should only be accessed in the lock. (Pierre d' Herbemont )
Rémi Denis-Courmont
remi at remlab.net
Tue Jun 9 09:36:58 CEST 2009
On Tue, 9 Jun 2009 06:24:59 +0200 (CEST), git at videolan.org (git version
control) wrote:
> vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Fri Jun
> 5 19:43:43 2009 -0700| [df6cae660efdd762466d93366e080f0efaa58325] |
> committer: Pierre d'Herbemont
>
> libvlc: ref_count should only be accessed in the lock.
>
>>
>
http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=df6cae660efdd762466d93366e080f0efaa58325
> ---
>
> src/control/core.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/src/control/core.c b/src/control/core.c
> index a083f5b..ececd0e 100644
> --- a/src/control/core.c
> +++ b/src/control/core.c
> @@ -165,9 +165,8 @@ void libvlc_release( libvlc_instance_t *p_instance )
> vlc_mutex_t *lock = &p_instance->instance_lock;
> int refs;
>
> - assert( p_instance->ref_count > 0 );
> -
> vlc_mutex_lock( lock );
> + assert( p_instance->ref_count > 0 );
> refs = --p_instance->ref_count;
> vlc_mutex_unlock( lock );
What? If the ref_count is zero, the lock should be already destroyed, and
vlc_mutex_lock() will crash before the assertion is checked.
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list