diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 20:41:10 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 20:41:10 +0300 |
| commit | 08dc9047098d6d96791024ac7d8f5837633673ef (patch) | |
| tree | b5176e593815ef21bc524888d7a02c53a6ed4d43 /src/cocoa/window.m | |
| parent | 353fbb5c2d6850ef740f21165f79ebda017d5982 (diff) | |
cocoa: fix drag image data provider creation
Diffstat (limited to 'src/cocoa/window.m')
| -rw-r--r-- | src/cocoa/window.m | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cocoa/window.m b/src/cocoa/window.m index 335c065..645ae07 100644 --- a/src/cocoa/window.m +++ b/src/cocoa/window.m @@ -1798,7 +1798,10 @@ static NSImage *image_from_pixels(const uint32_t *pixels, int width, int height) CGColorSpaceRef cs = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); if (!cs) return nil; size_t bytes = (size_t)width * (size_t)height * 4; - CGDataProviderRef provider = CGDataProviderCreateWithCopy((const uint8_t *)pixels, bytes); + CFDataRef data = CFDataCreate(kCFAllocatorDefault, (const UInt8 *)pixels, (CFIndex)bytes); + CGDataProviderRef provider = data ? CGDataProviderCreateWithCFData(data) : NULL; + if (data) + CFRelease(data); if (!provider) { CGColorSpaceRelease(cs); return nil; |
