summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kitchen <akitchen@gmail.com>2017-11-28 14:51:30 -0800
committerGitHub <noreply@github.com>2017-11-28 14:51:30 -0800
commitc178bd2d25a47e66a8307295e3e420b442f14037 (patch)
tree0d96469fbf7a656b5c6575e6ec22d330cc626100
parent09b97e037c8109795d14083fb8f3ebee67e179bb (diff)
downloadqtlocation-mapboxgl-c178bd2d25a47e66a8307295e3e420b442f14037.tar.gz
[darwin] Fixes CGImageRef leak when creating a map snapshot (#10585)
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.mm8
1 files changed, 6 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm
index dea93eba34..346666cf80 100644
--- a/platform/darwin/src/MGLMapSnapshotter.mm
+++ b/platform/darwin/src/MGLMapSnapshotter.mm
@@ -321,14 +321,18 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
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