diff options
Diffstat (limited to 'src/macextras/qmacfunctions_mac.mm')
-rw-r--r-- | src/macextras/qmacfunctions_mac.mm | 6 |
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; } |