diff options
author | danielmatzke <github@leetvision.com> | 2017-02-07 01:02:35 +0100 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-02-06 16:02:35 -0800 |
commit | 937fa0ce44df02d8c3fd0ff19bf104636a9c8bf3 (patch) | |
tree | 7874c1c6e5e698933a6f228befe1104db59cf64a /platform/macos/src | |
parent | f0d4411871d43012dc9e24a376ebc70ec6ca9224 (diff) | |
download | qtlocation-mapboxgl-937fa0ce44df02d8c3fd0ff19bf104636a9c8bf3.tar.gz |
[ios, macos] 7955 fix MGLMapView leaks MGLReachability objects (and threads) (#7956)
* fix MGLMapView leaks MGLReachability objects (and threads)
* fix leak of MGLReachability objects and threads in MGLMapView.commonInit
* update changelogs
Diffstat (limited to 'platform/macos/src')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 86d74d768d..d687a19aed 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -193,6 +193,9 @@ public: /// True if the view is currently printing itself. BOOL _isPrinting; + + /// reachability instance + MGLReachability *_reachability; } #pragma mark Lifecycle @@ -273,11 +276,11 @@ public: self.layer = _isTargetingInterfaceBuilder ? [CALayer layer] : [MGLOpenGLLayer layer]; // Notify map object when network reachability status changes. - MGLReachability *reachability = [MGLReachability reachabilityForInternetConnection]; - reachability.reachableBlock = ^(MGLReachability *) { + _reachability = [MGLReachability reachabilityForInternetConnection]; + _reachability.reachableBlock = ^(MGLReachability *) { mbgl::NetworkStatus::Reachable(); }; - [reachability startNotifier]; + [_reachability startNotifier]; // Install ornaments and gesture recognizers. [self installZoomControls]; @@ -497,6 +500,10 @@ public: } - (void)dealloc { + + [_reachability stopNotifier]; + + [self.window removeObserver:self forKeyPath:@"contentLayoutRect"]; [self.window removeObserver:self forKeyPath:@"titlebarAppearsTransparent"]; |