1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 21:06:00 +00:00

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.
This commit is contained in:
Stefano Pigozzi 2014-10-04 19:19:53 +02:00
parent c5ebaca31e
commit 0ec14ec597

View File

@ -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;
}