From 0ec14ec597a02cec8fb0c1aebd392681aba9c60c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 4 Oct 2014 19:19:53 +0200 Subject: [PATCH] cocoa: simplify the config code and run it on the main thread This could be dangerous because we initialize the window asynchronously and return immediately from config, but since the OpenGL context is already created, this seems to work correctly and doesn't cause weird deadlock cases. --- video/out/cocoa_common.m | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index eac930125a..7570f51637 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -366,9 +366,7 @@ void vo_cocoa_release_nsgl_ctx(struct vo *vo) int vo_cocoa_config_window(struct vo *vo, uint32_t flags, void *gl_ctx) { struct vo_cocoa_state *s = vo->cocoa; - __block int ctxok = 0; - - with_cocoa_lock(vo, ^{ + with_cocoa_lock_on_main_thread(vo, ^{ struct mp_rect screenrc; vo_cocoa_update_screen_info(vo, &screenrc); @@ -394,12 +392,6 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t flags, void *gl_ctx) cocoa_add_fs_screen_profile_observer(vo); } }); - - if (ctxok < 0) - return ctxok; - - [vo->cocoa->gl_ctx makeCurrentContext]; - return 0; }