[ios] Avoid removing annotations from torn-down map

If the underlying mbgl::Map has been torn down, so has the mbgl annotation, so don’t worry about the mbgl::Map but keep unregistering KVO and other SDK-side annotation resources.
This commit is contained in:
Minh Nguyễn
2020-04-01 00:59:14 -07:00
committed by Minh Nguyễn
parent 74f5a64035
commit 1a9ab40801
2 changed files with 7 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
### Other changes
* Added the `MGLMapView.minimumPitch` and `MGLMapView.maximumPitch` properties to further limit how much the user or your code can tilt the map. ([#208](https://github.com/mapbox/mapbox-gl-native-ios/pull/208))
* Fixed a crash while quitting the application after adding an annotation to `MGLMapView`. ([#252](https://github.com/mapbox/mapbox-gl-native-ios/pull/252))
* Improved performance when continuously animating a tilted map. ([#16287](https://github.com/mapbox/mapbox-gl-native/pull/16287))
* Fixed a memory leak when zooming with any options enabled in the `MGLMapView.debugMask` property. ([#15179](https://github.com/mapbox/mapbox-gl-native/issues/15179))

View File

@@ -4612,7 +4612,12 @@ public:
}
_isChangingAnnotationLayers = YES;
self.mbglMap.removeAnnotation(annotationTag);
// If the underlying map is gone, there’s nothing to remove, but still
// continue to unregister KVO and other annotation resources.
if (_mbglMap)
{
self.mbglMap.removeAnnotation(annotationTag);
}
}
[self updatePresentsWithTransaction];