Cocoa: fix memory leak

Release the created CGImageRef.

Change-Id: If3b36b636ae1302b8a63bbae7285a6461b993f62
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Teemu Katajisto 2012-10-17 15:42:06 +03:00 committed by The Qt Project
parent 0a7e6c5856
commit 3ebee851b2

View File

@ -135,7 +135,10 @@ NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
NSImage *qt_mac_create_nsimage(const QPixmap &pm) NSImage *qt_mac_create_nsimage(const QPixmap &pm)
{ {
QImage image = pm.toImage(); QImage image = pm.toImage();
return qt_mac_cgimage_to_nsimage(qt_mac_image_to_cgimage(image)); CGImageRef cgImage = qt_mac_image_to_cgimage(image);
NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
CGImageRelease(cgImage);
return nsImage;
} }
HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region) HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region)