Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Fix dangling KVO observer crash #4806

Merged
merged 1 commit into from
Apr 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,9 @@ - (void)dealloc
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_attributionButton removeObserver:self forKeyPath:@"hidden"];

// Removing the annotations unregisters any outstanding KVO observers.
[self removeAnnotations:self.annotations];

[self validateDisplayLink];

if (_mbglMap)
Expand Down
3 changes: 3 additions & 0 deletions platform/osx/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ - (void)dealloc {
[self.calloutForSelectedAnnotation close];
self.calloutForSelectedAnnotation = nil;

// Removing the annotations unregisters any outstanding KVO observers.
[self removeAnnotations:self.annotations];

if (_mbglMap) {
delete _mbglMap;
_mbglMap = nullptr;
Expand Down