Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit d6a9244

Browse files
committed
[[ Bug 23038 ]] Fix creation of color profiles on macOS
This patch fixes an issue with the creation of color profiles from embedded ICC information. Previously the NoCopy CFDataRef constructor was being used to wrap the raw bytes to be passed to the relevant CGColorSpaceRef constructor. However, the data wrapped in this way could be released at any time, and in versions of macOS since Mojave it appears that the OS defers copying the data thus causing strange effects when the color profile is eventually applied. The problem has been fixed by using the normal CFDataRef constructor which copies the provided bytes.
1 parent e5f7a76 commit d6a9244

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

docs/notes/bugfix-23038.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix some images rendering as black in recent macOS versions

engine/src/mac-color.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void MCPlatformCreateColorTransform(const MCColorSpaceInfo& p_info, MCPlatformCo
7272
CFDataRef t_data;
7373
t_data = nil;
7474

75-
t_success = nil != (t_data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, (UInt8*)p_info.embedded.data, p_info.embedded.data_size, kCFAllocatorNull));
75+
t_success = nil != (t_data = CFDataCreate(kCFAllocatorDefault, (UInt8*)p_info.embedded.data, p_info.embedded.data_size));
7676

7777
if (t_success)
7878
t_success = nil != (t_colorspace = CGColorSpaceCreateWithICCProfile(t_data));

0 commit comments

Comments
 (0)