[vlc-commits] coregraphicslayer: fix memleak and avoid unnecessary image copy
David Fuhrmann
git at videolan.org
Mon Jan 27 16:15:19 CET 2014
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon Jan 27 16:09:09 2014 +0100| [3fbb103ab60aa88161414975e9140b68dfd695b9] | committer: David Fuhrmann
coregraphicslayer: fix memleak and avoid unnecessary image copy
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3fbb103ab60aa88161414975e9140b68dfd695b9
---
modules/video_output/coregraphicslayer.m | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/modules/video_output/coregraphicslayer.m b/modules/video_output/coregraphicslayer.m
index 824e806..b36b372 100644
--- a/modules/video_output/coregraphicslayer.m
+++ b/modules/video_output/coregraphicslayer.m
@@ -255,6 +255,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
kCGRenderingIntentPerceptual);
CGDataProviderRelease(dataProvider);
+ CFRelease(dataRef);
if (!newFrame)
goto end;
@@ -289,6 +290,14 @@ static int Control(vout_display_t *vd, int query, va_list args)
return self;
}
+- (void) dealloc
+{
+ if (_lastFrame)
+ CGImageRelease(_lastFrame);
+
+ [super dealloc];
+}
+
- (bool)locked
{
return lock;
@@ -302,8 +311,10 @@ static int Control(vout_display_t *vd, int query, va_list args)
return;
}
- _lastFrame = CGImageCreateCopy(lastFrame);
- CGImageRelease(lastFrame);
+ if (_lastFrame)
+ CGImageRelease(_lastFrame);
+
+ _lastFrame = lastFrame;
CGRect invalidRect = CGRectMake(0, 0, CGImageGetWidth(_lastFrame), CGImageGetHeight(_lastFrame));
[CATransaction begin];
[self setNeedsDisplayInRect:invalidRect];
More information about the vlc-commits
mailing list