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

Marvin Scholz epirat07 at gmail.com
Sun Jan 20 04:36:26 CET 2019


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)



More information about the vlc-devel mailing list