diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.mm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 5ec2cea362..795ae53605 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -764,6 +764,9 @@ CGContextRef qt_mac_cg_context(QPaintDevice *pdev) return ret; } +// qpaintengine_mac.mm +extern void qt_mac_cgimage_data_free(void *, const void *memoryToFree, size_t); + CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) { int width = qImage.width(); @@ -777,8 +780,7 @@ CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) const uchar *imageData = qImage.bits(); if (dataCopy) { - delete[] *dataCopy; - *dataCopy = new uchar[qImage.byteCount()]; + *dataCopy = static_cast<uchar *>(malloc(qImage.byteCount())); memcpy(*dataCopy, imageData, qImage.byteCount()); } int bitDepth = qImage.depth(); @@ -789,7 +791,7 @@ CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) NULL, dataCopy ? *dataCopy : imageData, qImage.byteCount(), - NULL); + dataCopy ? qt_mac_cgimage_data_free : NULL); CGImageRef cgImage = 0; if (isMask) { |