summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2015-03-07 09:11:47 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-03-11 12:49:33 +0900
commit324a40d2e1919c87389e285d94045edd00778428 (patch)
treeb02213bba6abce040974122cdc5a266a0fb2cb60
parent83e98d3adaa4da3fcea817c3fbbb29d8c975e351 (diff)
downloadmpv-324a40d2e1919c87389e285d94045edd00778428.tar.bz2
mpv-324a40d2e1919c87389e285d94045edd00778428.tar.xz
cocoa: remove possible use after free
(cherry picked from commit 5cddd4ccca79405ea57fcd423a554ddf12da0126)
-rw-r--r--video/out/cocoa_common.m8
1 files changed, 4 insertions, 4 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 172f973cf1..b9aa1febee 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -87,9 +87,8 @@ struct vo_cocoa_state {
void (*resize_redraw)(struct vo *vo, int w, int h);
};
-static void with_cocoa_lock(struct vo *vo, void(^block)(void))
+static void with_cocoa_lock(struct vo_cocoa_state *s, void(^block)(void))
{
- struct vo_cocoa_state *s = vo->cocoa;
cocoa_lock(s);
block();
cocoa_unlock(s);
@@ -97,8 +96,9 @@ static void with_cocoa_lock(struct vo *vo, void(^block)(void))
static void with_cocoa_lock_on_main_thread(struct vo *vo, void(^block)(void))
{
+ struct vo_cocoa_state *s = vo->cocoa;
dispatch_async(dispatch_get_main_queue(), ^{
- with_cocoa_lock(vo, block);
+ with_cocoa_lock(s, block);
});
}
@@ -626,7 +626,7 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
return vo_cocoa_ontop(vo);
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
int *s = arg;
- with_cocoa_lock(vo, ^{
+ with_cocoa_lock(vo->cocoa, ^{
NSSize size = [vo->cocoa->view frame].size;
s[0] = size.width;
s[1] = size.height;