Make a copy of the src data (it will go away) Since we return the image itself, we have to (conservatively) tell cg to copy the src data, since we're not sure when they'll be done with it. Add some diagnostic checks as well, but the key change is from CFDataCreateWithBytesNoCopy to CFDataCreate Diffs= 7ae06e8b8 Make a copy of the src data (it will go away)
diff --git a/.rive_head b/.rive_head index d4c9491..9b4a9c3 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -7e1393ae7bda97daf4bd481756d24b94696722e4 +7ae06e8b84d9d1cb3d97248db66e468d1f2b3db7
diff --git a/skia/renderer/src/mac_utils.cpp b/skia/renderer/src/mac_utils.cpp index de6a2a3..cddcf4e 100644 --- a/skia/renderer/src/mac_utils.cpp +++ b/skia/renderer/src/mac_utils.cpp
@@ -12,17 +12,24 @@ #endif CGImageRef rive::DecodeToCGImage(rive::Span<const uint8_t> span) { - AutoCF data = CFDataCreateWithBytesNoCopy(nullptr, span.data(), span.size(), nullptr); + AutoCF data = CFDataCreate(nullptr, span.data(), span.size()); if (!data) { + printf("CFDataCreate failed\n"); return nullptr; } AutoCF source = CGImageSourceCreateWithData(data, nullptr); if (!source) { + printf("CGImageSourceCreateWithData failed\n"); return nullptr; } - return CGImageSourceCreateImageAtIndex(source, 0, nullptr); + auto image = CGImageSourceCreateImageAtIndex(source, 0, nullptr); + if (!image) { + printf("CGImageSourceCreateImageAtIndex failed\n"); + return nullptr; + } + return image; } #endif