diff options
author | Damiano Galassi <[email protected]> | 2016-10-05 10:55:45 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2016-10-05 10:55:45 +0200 |
commit | 3fe7f1de0362a38b36edae2a831cec450089d202 (patch) | |
tree | 2dc1a2a2cf5e518ea9784a0b9850603a696cc97e /macosx/HBToolbarBadgedItem.m | |
parent | eaa2aed959c999467bc8c28cbe7be021785c5723 (diff) |
MacGui: fix a small memory leak in the NSColor -> CGColor conversion.
Diffstat (limited to 'macosx/HBToolbarBadgedItem.m')
-rw-r--r-- | macosx/HBToolbarBadgedItem.m | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/macosx/HBToolbarBadgedItem.m b/macosx/HBToolbarBadgedItem.m index 135174701..e1eec2066 100644 --- a/macosx/HBToolbarBadgedItem.m +++ b/macosx/HBToolbarBadgedItem.m @@ -85,7 +85,7 @@ #pragma mark -- Private Methods -- (CGColorRef)HB_NSColorToCGColor:(NSColor *)color +- (CGColorRef)copyNSColorToCGColor:(NSColor *)color { // CGColor property of NSColor has been added only in 10.8, // we need to support 10.7 too. @@ -178,7 +178,9 @@ CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, radius); CGContextAddArcToPoint(context, minx, maxy, minx, midy, radius); CGContextClosePath(context); - CGContextSetFillColorWithColor(context, [self HB_NSColorToCGColor:_badgeFillColor]); + CGColorRef fillColor = [self copyNSColorToCGColor:_badgeFillColor]; + CGContextSetFillColorWithColor(context,fillColor); + CFRelease(fillColor); CGContextDrawPath(context, kCGPathFill); // Draw the text |