cocoa: unlock on uninit

NSLock should be unlocked before dealloc is called on it.
This commit is contained in:
Stefano Pigozzi 2013-11-26 19:01:52 +01:00 committed by wm4
parent bbff558e6e
commit eeb37de8ca
1 changed files with 3 additions and 1 deletions

View File

@ -136,6 +136,7 @@ static void vo_cocoa_set_cursor_visibility(struct vo *vo, bool *visible)
void vo_cocoa_uninit(struct vo *vo)
{
vo_cocoa_set_current_context(vo, false);
dispatch_sync(dispatch_get_main_queue(), ^{
struct vo_cocoa_state *s = vo->cocoa;
enable_power_management(vo);
@ -444,9 +445,10 @@ void vo_cocoa_set_current_context(struct vo *vo, bool current)
[s->gl_ctx makeCurrentContext];
} else {
const bool locked = !![NSOpenGLContext currentContext];
[NSOpenGLContext clearCurrentContext];
if (!s->inside_sync_section)
if (!s->inside_sync_section && locked)
[s->lock unlock];
}
}