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

7955 fix MGLMapView leaks MGLReachability objects (and threads) #7956

Merged
merged 3 commits into from
Feb 7, 2017
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix leak of MGLReachability objects and threads in MGLMapView.commonInit
  • Loading branch information
Daniel Matzke (mac) authored and 1ec5 committed Feb 6, 2017
commit 54ba24798a6859cc8b045c7bb9a4aac6cd70cd5b
10 changes: 7 additions & 3 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ @implementation MGLMapView
MGLCompassDirectionFormatter *_accessibilityCompassFormatter;

NS_ARRAY_OF(MGLAttributionInfo *) *_attributionInfos;

MGLReachability *_reachability;
}

#pragma mark - Setup & Teardown -
Expand Down Expand Up @@ -440,12 +442,12 @@ - (void)commonInit
name:kMGLReachabilityChangedNotification
object:nil];

MGLReachability* reachability = [MGLReachability reachabilityForInternetConnection];
if ([reachability isReachable])
_reachability = [MGLReachability reachabilityForInternetConnection];
if ([_reachability isReachable])
{
_isWaitingForRedundantReachableNotification = YES;
}
[reachability startNotifier];
[_reachability startNotifier];

// Set up annotation management and selection state.
_annotationImagesByIdentifier = [NSMutableDictionary dictionary];
Expand Down Expand Up @@ -664,6 +666,8 @@ - (void)reachabilityChanged:(NSNotification *)notification

- (void)dealloc
{
[_reachability stopNotifier];

[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_attributionButton removeObserver:self forKeyPath:@"hidden"];
Expand Down