aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2015-05-26 10:19:24 +0200
committerAndy Shaw <andy.shaw@theqtcompany.com>2015-05-26 08:27:17 +0000
commit3a3a7d799b4f57fc81cd2bef596f63aa68d42b41 (patch)
tree54a3facc67867c912a76593e418fafacb8a0a809 /src
parent0b5793251af8c8a9355a01ee277df8ab99aaac70 (diff)
Release the CGImageRef as this is no longer required5.4
Change-Id: I837869f739032ddea60e7e894795c921cbf730db Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/macextras/qmacfunctions_mac.mm6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/macextras/qmacfunctions_mac.mm b/src/macextras/qmacfunctions_mac.mm
index 38f941f..34af26f 100644
--- a/src/macextras/qmacfunctions_mac.mm
+++ b/src/macextras/qmacfunctions_mac.mm
@@ -67,10 +67,14 @@ namespace QtMac
*/
NSImage* toNSImage(const QPixmap &pixmap)
{
- NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:toCGImageRef(pixmap)];
+ if (pixmap.isNull())
+ return 0;
+ CGImageRef cgimage = toCGImageRef(pixmap);
+ NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:cgimage];
NSImage *image = [[NSImage alloc] init];
[image addRepresentation:bitmapRep];
[bitmapRep release];
+ CFRelease(cgimage);
return image;
}