Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[darwin] Fixes CGImageRef leak when creating a map snapshot #10585

Merged
merged 1 commit into from
Nov 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions platform/darwin/src/MGLMapSnapshotter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,18 @@ - (MGLImage *)blurredAttributionBackground:(CIImage *)backgroundImage

CIContext *ctx = [CIContext contextWithOptions:nil];
CGImageRef cgimg = [ctx createCGImage:blurredImage fromRect:[backgroundImage extent]];
MGLImage *image;

#if TARGET_OS_IPHONE

return [UIImage imageWithCGImage:cgimg];
image = [UIImage imageWithCGImage:cgimg];
#else

return [[NSImage alloc] initWithCGImage:cgimg size:[backgroundImage extent].size];
image = [[NSImage alloc] initWithCGImage:cgimg size:[backgroundImage extent].size];
#endif

CGImageRelease(cgimg);
return image;
}

- (void)cancel
Expand Down