summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2014-10-27 19:10:52 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2014-10-27 19:14:55 +0100
commit55396ee554aeb1fea844eaabd0b5c7a244143306 (patch)
treeacc949b66c445104e3db3b71e6e4fcc5e567b39d /video
parent58effd3fec61c723f7872a82299bb8ac9aaf23cc (diff)
downloadmpv-55396ee554aeb1fea844eaabd0b5c7a244143306.tar.bz2
mpv-55396ee554aeb1fea844eaabd0b5c7a244143306.tar.xz
libmpv: cocoa: fix view leak on uninit
The code was lacking a -removeFromSuperview call which resulted in a leak on our part if the parent view in the client was not released.
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa_common.m10
1 files changed, 6 insertions, 4 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index dde727f5de..19968de8ff 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -192,9 +192,9 @@ void vo_cocoa_uninit(struct vo *vo)
enable_power_management(vo);
cocoa_rm_fs_screen_profile_observer(vo);
- [s->video release];
- [s->view release];
- [s->window release];
+ [s->gl_ctx release];
+ [s->view removeFromSuperview];
+ if (s->window) [s->window release];
});
}
@@ -310,7 +310,7 @@ static void create_ui(struct vo *vo, struct mp_rect *win, int geo_flags)
struct vo_cocoa_state *s = vo->cocoa;
struct mp_vo_opts *opts = vo->opts;
- MpvCocoaAdapter *adapter = [[[MpvCocoaAdapter alloc] init] autorelease];
+ MpvCocoaAdapter *adapter = [[MpvCocoaAdapter alloc] init];
adapter.vout = vo;
NSView *parent;
@@ -327,6 +327,7 @@ static void create_ui(struct vo *vo, struct mp_rect *win, int geo_flags)
view.adapter = adapter;
s->view = view;
[parent addSubview:s->view];
+ [s->view release];
// insert ourselves as the next key view so that clients can give key
// focus to the mpv view by calling -[NSWindow selectNextKeyView:]
@@ -345,6 +346,7 @@ static void create_ui(struct vo *vo, struct mp_rect *win, int geo_flags)
[s->view addSubview:s->video];
[s->gl_ctx setView:s->video];
+ [s->video release];
s->video.adapter = adapter;