summaryrefslogtreecommitdiff
path: root/platform/ios/src/MGLMapView.mm
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2018-04-24 20:32:43 -0400
committerJason Wray <jason@mapbox.com>2018-04-27 18:06:42 -0400
commit5a147f6335314defeed26c570ebcfe217e2af5d9 (patch)
tree05cc2ba8a7a65053baff045fe11801533a9d1a16 /platform/ios/src/MGLMapView.mm
parent4f7999fd1cec34e9beaf130d30897548d8dbca4a (diff)
downloadqtlocation-mapboxgl-5a147f6335314defeed26c570ebcfe217e2af5d9.tar.gz
[ios, macos] Fix possible retain cycles in blocks
Prompted by enabling CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF.
Diffstat (limited to 'platform/ios/src/MGLMapView.mm')
-rw-r--r--platform/ios/src/MGLMapView.mm14
1 files changed, 11 insertions, 3 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index c679979d37..34269ce442 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -4570,6 +4570,8 @@ public:
return;
}
+ __weak __typeof__(self) weakSelf = self;
+
// The user location callout view initially points to the user location
// annotation’s implicit (visual) frame, which is offset from the
// annotation’s explicit frame. Now the callout view needs to rendezvous
@@ -4583,10 +4585,16 @@ public:
UIViewAnimationOptionBeginFromCurrentState)
animations:^
{
+ __typeof__(self) strongSelf = weakSelf;
+ if ( ! strongSelf)
+ {
+ return;
+ }
+
calloutView.frame = CGRectOffset(calloutView.frame,
- _initialImplicitCalloutViewOffset.x,
- _initialImplicitCalloutViewOffset.y);
- _initialImplicitCalloutViewOffset = CGPointZero;
+ strongSelf->_initialImplicitCalloutViewOffset.x,
+ strongSelf->_initialImplicitCalloutViewOffset.y);
+ strongSelf->_initialImplicitCalloutViewOffset = CGPointZero;
}
completion:NULL];
}