aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-05-26 12:29:45 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-05-26 12:29:45 +0200
commite16dffd3e0e8dbc1aadb686b6c502944d9557de9 (patch)
tree46011f6abdd54d2567e7985d132f78594db9751a /src
parentd709388240837cf82cb68ac98c60c1565132a802 (diff)
parent3a3a7d799b4f57fc81cd2bef596f63aa68d42b41 (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5v5.5.0-rc1v5.5.0
Conflicts: .qmake.conf Change-Id: I769ed6443b24c3329f614807d91bcfdde93939f9
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 b14c9b7..99515c1 100644
--- a/src/macextras/qmacfunctions_mac.mm
+++ b/src/macextras/qmacfunctions_mac.mm
@@ -59,10 +59,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;
}