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

Rémi Denis-Courmont remi at remlab.net
Sun Jan 20 10:04:46 CET 2019


Hi,

Patch makes sense, but does the dispatched-to thread ever wait directly or indirectly on the input thread to end? If so, this might trigger a deadlock.

Note that with or without the patch, depending on an unknown thread to exist to run an access is a bad idea. I tried that approach with the PulseAudio input and it lead to intractable deadlocks with the output. Also, if a LibVLC app has no such thread, then nothing good can happen.

Le 20 janvier 2019 05:36:26 GMT+02:00, Marvin Scholz <epirat07 at gmail.com> a écrit :
>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

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190120/aed48c9e/attachment.html>


More information about the vlc-devel mailing list