summaryrefslogtreecommitdiff
path: root/platform/ios/app/MBXSnapshotsViewController.m
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-02-06 18:08:34 -0500
committerFabian Guerra <fabian.guerra@mapbox.com>2018-02-12 13:47:41 -0500
commitb1a873199e145770301463e99640c1aa298fc5e7 (patch)
tree82ae0941f37b844ffed0d69c4788816cb6ba1443 /platform/ios/app/MBXSnapshotsViewController.m
parentcdaf90d2e75a8d8f6924caf657ca5ff3d1ae6adb (diff)
downloadqtlocation-mapboxgl-upstream/fabian-snapshotter-leaks-11117.tar.gz
[ios, macos] Fix memory leaks in MGLMapSnapshotter.upstream/fabian-snapshotter-leaks-11117
Diffstat (limited to 'platform/ios/app/MBXSnapshotsViewController.m')
-rw-r--r--platform/ios/app/MBXSnapshotsViewController.m3
1 files changed, 2 insertions, 1 deletions
diff --git a/platform/ios/app/MBXSnapshotsViewController.m b/platform/ios/app/MBXSnapshotsViewController.m
index 3bf93d8721..95d3251e2e 100644
--- a/platform/ios/app/MBXSnapshotsViewController.m
+++ b/platform/ios/app/MBXSnapshotsViewController.m
@@ -50,12 +50,13 @@
options.zoomLevel = 10;
// Create and start the snapshotter
+ __weak UIImageView *weakImageView = imageView;
MGLMapSnapshotter* snapshotter = [[MGLMapSnapshotter alloc] initWithOptions:options];
[snapshotter startWithCompletionHandler: ^(MGLMapSnapshot* snapshot, NSError *error) {
if (error) {
NSLog(@"Could not load snapshot: %@", [error localizedDescription]);
} else {
- imageView.image = snapshot.image;
+ weakImageView.image = snapshot.image;
}
}];