summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-28 14:53:55 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-28 15:08:26 +0200
commit73808cd8f0dd30e4cf361fc4bce20cb347e65172 (patch)
tree43a64dc2f6a5549bbd1f866067a98ce3be14f49d /video
parent67d87d36d52baf5237f24c4bf5d83426362f25b0 (diff)
downloadmpv-73808cd8f0dd30e4cf361fc4bce20cb347e65172.tar.bz2
mpv-73808cd8f0dd30e4cf361fc4bce20cb347e65172.tar.xz
cocoa_common: fix deadlock
After rebasing my dev branch it turned out that the code deadlocked on recursive calls of `vo_control`. Make the locking code a little bit smarter by making always skip locking/unlocking if we are executing a chunck of code that is already synchronized with `dispatch_sync`.
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa_common.m12
1 files changed, 7 insertions, 5 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 612ea27c73..b15ffd3d36 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -353,8 +353,7 @@ static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height)
if (!s->resize_redraw)
return;
- if (!s->inside_sync_section)
- vo_cocoa_set_current_context(vo, true);
+ vo_cocoa_set_current_context(vo, true);
[s->gl_ctx update];
@@ -367,9 +366,7 @@ static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height)
}
[s->gl_ctx flushBuffer];
-
- if (!s->inside_sync_section)
- vo_cocoa_set_current_context(vo, false);
+ vo_cocoa_set_current_context(vo, false);
}
int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
@@ -428,6 +425,11 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
void vo_cocoa_set_current_context(struct vo *vo, bool current)
{
struct vo_cocoa_state *s = vo->cocoa;
+
+ if (s->inside_sync_section) {
+ return;
+ }
+
if (current) {
[s->lock lock];
[s->gl_ctx makeCurrentContext];