[vlc-devel] [PATCH] vout/macosx: simplify close and make sure all AppKit objects are released on the main thread
Felix Paul Kühne
fkuehne at videolan.org
Wed Sep 18 07:11:42 CEST 2019
Hi David,
> On 17. Sep 2019, at 23:10, David Fuhrmann <david.fuhrmann at gmail.com> wrote:
>
>
>> Am 17.09.2019 um 22:12 schrieb Felix Paul Kühne <fkuehne at videolan.org>:
>>
>> From: Felix Paul Kühne <felix at feepk.net>
>>
>> Note that this does _not_ solve #22766.
>> ---
>> modules/video_output/macosx.m | 29 +++++++++++++----------------
>> 1 file changed, 13 insertions(+), 16 deletions(-)
>>
>> diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
>> index 6290bbf763..5f618a0716 100644
>> --- a/modules/video_output/macosx.m
>> +++ b/modules/video_output/macosx.m
>> @@ -265,21 +265,20 @@ static void Close(vout_display_t *vd)
>> [sys->glView setVoutDisplay:nil];
>>
>> var_Destroy (vd, "drawable-nsobject");
>> - if ([(id)sys->container respondsToSelector:@selector(removeVoutSubview:)])
>> - /* This will retain sys->glView */
>> - [(id)sys->container performSelectorOnMainThread:@selector(removeVoutSubview:)
>> - withObject:sys->glView
>> - waitUntilDone:NO];
>> -
>> - /* release on main thread as explained in Open() */
>> - [(id)sys->container performSelectorOnMainThread:@selector(release)
>> - withObject:nil
>> - waitUntilDone:NO];
>> - [sys->glView performSelectorOnMainThread:@selector(removeFromSuperview)
>> - withObject:nil
>> - waitUntilDone:NO];
>> -
>> var_Destroy(vlc_object_parent(vd), "macosx-glcontext");
>> +
>> + dispatch_sync(dispatch_get_main_queue(), ^{
>
> As briefly discussed over chat, my fear is that this switch from async to sync deadlocks once closing VLC with a running video.
>
> In fact, I can easily reproduce this with your patch applied, just try to quit VLC while a video is running:
I don’t oppose using async here. The main issue I want to resolve is that [sys->glView release]; is currently called from a background thread while this AppKit object is created on the main thread, so the release should happen on the main thread, too.
Best regards,
Felix
More information about the vlc-devel
mailing list