summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-22 12:53:19 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-04-22 15:43:55 -0700
commit1039f215273d8fb39d857bd6f82601f946d832c6 (patch)
tree3de8d39cf31e8261768fa9a150fe018692f0280a /platform/osx
parenta7527d6986418c0560c4704f8684a81ce83178db (diff)
downloadqtlocation-mapboxgl-1039f215273d8fb39d857bd6f82601f946d832c6.tar.gz
[ios, osx] Fixed dangling KVO observer crash
Fixed a crash when deallocating an MGLMapView that has point annotations. Now we explicitly remove all the annotations from the view and thus remove all remaining KVO observers on those annotations. Fixes #4805.
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/src/MGLMapView.mm3
1 files changed, 3 insertions, 0 deletions
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index 6ef93b70cf..c707ef2571 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -450,6 +450,9 @@ public:
[self.calloutForSelectedAnnotation close];
self.calloutForSelectedAnnotation = nil;
+ // Removing the annotations unregisters any outstanding KVO observers.
+ [self removeAnnotations:self.annotations];
+
if (_mbglMap) {
delete _mbglMap;
_mbglMap = nullptr;