[vlc-devel] [PATCH] access/qtsound: Fix race in qtsound close

David Fuhrmann david.fuhrmann at gmail.com
Sun Jan 20 10:39:25 CET 2019


Hi Marvin,

I believe this is not a good idea: If you run a QTsound session and then quit VLC, the main loop will stop before qtsound is closed, and you have a deadlock.

I think we need to question why this is needed at all. So far, I did not find any convincing reasons or bug reports why this destruction can’t be done in the same thread.

AVAudioCapture is the replacement of QTsound in vlc.git, and here we have the same problem. For now, I decided to just destruct everything on the same thread there, and so far I see no problems with that.

Best,
David

> Am 20.01.2019 um 04:36 schrieb Marvin Scholz <epirat07 at gmail.com>:
> 
> Destruction of qtsound objects was dispatched async to the main thread,
> this causes a race so that the qtsound objects can still be around when
> the actual VLC objects those rely on are already gone (because Close was
> already left), causing weird crashes.
> 
> Ref CD 0ee7a644-041f-453d-a196-7cdd75acaf3b
> ---
> modules/access/qtsound.m | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/access/qtsound.m b/modules/access/qtsound.m
> index 533d6e81344..ab44e12d777 100644
> --- a/modules/access/qtsound.m
> +++ b/modules/access/qtsound.m
> @@ -504,9 +504,9 @@ static void Close(vlc_object_t *p_this)
>         demux_t *p_demux = (demux_t*)p_this;
>         demux_sys_t *p_sys = p_demux->p_sys;
> 
> -        [p_sys->session performSelectorOnMainThread:@selector(stopRunning) withObject:nil waitUntilDone:NO];
> -        [p_sys->audiooutput performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:NO];
> -        [p_sys->session performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:NO];
> +        [p_sys->session performSelectorOnMainThread:@selector(stopRunning) withObject:nil waitUntilDone:YES];
> +        [p_sys->audiooutput performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:YES];
> +        [p_sys->session performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:YES];
> 
>         free(p_sys);
>     }
> -- 
> 2.17.2 (Apple Git-113)
> 
> _______________________________________________
> 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