[vlc-devel] [PATCH 2/2] lib: core: Check refcount from the locked scope

Steve Lhomme robux4 at ycbcr.xyz
Wed Mar 11 08:34:08 CET 2020


On 2020-03-10 17:28, Rémi Denis-Courmont wrote:
> Le tiistaina 10. maaliskuuta 2020, 11.25.21 EET Hugo Beauzée-Luyssen a écrit :
>> ---
>>   lib/core.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/core.c b/lib/core.c
>> index 56b985f597..1239173710 100644
>> --- a/lib/core.c
>> +++ b/lib/core.c
>> @@ -74,9 +74,9 @@ error:
>>   void libvlc_retain( libvlc_instance_t *p_instance )
>>   {
>>       assert( p_instance != NULL );
>> -    assert( p_instance->ref_count < UINT_MAX );
>>
>>       vlc_mutex_lock( &p_instance->instance_lock );
>> +    assert( p_instance->ref_count < UINT_MAX );
>>       p_instance->ref_count++;
>>       vlc_mutex_unlock( &p_instance->instance_lock );
>>   }
> 
> Sure but shouldn't this use an atomic reference counter by now?

That seems doable. Although we'll still need the lock that is used in 
libvlc_dialog_set_callbacks().

> -- 
> 雷米‧德尼-库尔蒙
> http://www.remlab.net/
> 
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list