summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-12 23:51:58 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-12 23:51:58 +0200
commit35c8f7b6082871d690c4355d5173dde939bf60ec (patch)
treec5805aee2bf758fe802b885e3a4df0cc85013e78
parentbb569b56de1a8abd637772aaa584ade8abfda6ad (diff)
downloadmpv-35c8f7b6082871d690c4355d5173dde939bf60ec.tar.bz2
mpv-35c8f7b6082871d690c4355d5173dde939bf60ec.tar.xz
cocoa_common: fix deadlock when calling resize_redraw
Fixes #82
-rw-r--r--video/out/cocoa_common.m13
1 files changed, 9 insertions, 4 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 481096fd96..90a9508106 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -178,6 +178,8 @@ struct vo_cocoa_state {
CGFloat accumulated_scroll;
NSRecursiveLock *lock;
+
+ bool enable_resize_redraw;
void (*resize_redraw)(struct vo *vo, int w, int h);
struct vo_cocoa_input_queue *input_queue;
@@ -202,6 +204,7 @@ static struct vo_cocoa_state *vo_cocoa_init_state(struct vo *vo)
.accumulated_scroll = 0,
.lock = [[NSRecursiveLock alloc] init],
.input_queue = vo_cocoa_input_queue_init(s),
+ .enable_resize_redraw = NO,
};
if (!vo->opts->border) s->windowed_mask = NSBorderlessWindowMask;
@@ -500,11 +503,12 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
uint32_t d_height, uint32_t flags,
int gl3profile)
{
+ struct vo_cocoa_state *s = vo->cocoa;
+ struct mp_vo_opts *opts = vo->opts;
__block int rv = 0;
- dispatch_sync(dispatch_get_main_queue(), ^{
- struct vo_cocoa_state *s = vo->cocoa;
- struct mp_vo_opts *opts = vo->opts;
+ s->enable_resize_redraw = NO;
+ dispatch_sync(dispatch_get_main_queue(), ^{
if (vo->config_count > 0) {
NSPoint origin = [s->window frame].origin;
vo->dx = origin.x;
@@ -551,6 +555,7 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
});
[vo->cocoa->glContext makeCurrentContext];
+ s->enable_resize_redraw = YES;
return rv;
}
@@ -558,7 +563,7 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
static bool resize_callback_registered(struct vo *vo)
{
struct vo_cocoa_state *s = vo->cocoa;
- return s->resize_redraw;
+ return s->enable_resize_redraw && !!s->resize_redraw;
}
void vo_cocoa_set_current_context(struct vo *vo, bool current)