summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-03-12 11:32:52 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-03-14 11:54:50 -0700
commitcaef1785eb8bb5471ccfbd6a8327888513818134 (patch)
tree4cb26306fe417c211c7124fe9a0ecb7273c3a9b2
parenta396c6a7f082749476f332c976912f37cbd93c92 (diff)
downloadqtlocation-mapboxgl-caef1785eb8bb5471ccfbd6a8327888513818134.tar.gz
[ios, osx] Removed pack nil check from MGLOfflineRegionObserver
Due to ARC, MGLOfflinePack can be deallocated at any time following its initialization. -dealloc ensures that the offline region observer is unset, but that step is asynchronous; there is no guarantee that it completes before the first status change update. In fact, the pack is deallocated before the first status change update unless it is captured outside of the MGLOfflinePackAdditionCompletionHandler. The pack nil check is unnecessary because the subsequent code would be a no-op.
-rw-r--r--platform/darwin/src/MGLOfflinePack.mm6
1 files changed, 0 insertions, 6 deletions
diff --git a/platform/darwin/src/MGLOfflinePack.mm b/platform/darwin/src/MGLOfflinePack.mm
index c6e483e6d1..42bd871e54 100644
--- a/platform/darwin/src/MGLOfflinePack.mm
+++ b/platform/darwin/src/MGLOfflinePack.mm
@@ -189,16 +189,12 @@ NSError *MGLErrorFromResponseError(mbgl::Response::Error error) {
void MBGLOfflineRegionObserver::statusChanged(mbgl::OfflineRegionStatus status) {
dispatch_async(dispatch_get_main_queue(), ^{
- NSCAssert(pack, @"MBGLOfflineRegionObserver is dangling without an associated MGLOfflinePack.");
-
[pack offlineRegionStatusDidChange:status];
});
}
void MBGLOfflineRegionObserver::responseError(mbgl::Response::Error error) {
dispatch_async(dispatch_get_main_queue(), ^{
- NSCAssert(pack, @"MBGLOfflineRegionObserver is dangling without an associated MGLOfflinePack.");
-
if ([pack.delegate respondsToSelector:@selector(offlinePack:didReceiveError:)]) {
[pack.delegate offlinePack:pack didReceiveError:MGLErrorFromResponseError(error)];
}
@@ -207,8 +203,6 @@ void MBGLOfflineRegionObserver::responseError(mbgl::Response::Error error) {
void MBGLOfflineRegionObserver::mapboxTileCountLimitExceeded(uint64_t limit) {
dispatch_async(dispatch_get_main_queue(), ^{
- NSCAssert(pack, @"MBGLOfflineRegionObserver is dangling without an associated MGLOfflinePack.");
-
if ([pack.delegate respondsToSelector:@selector(offlinePack:didReceiveMaximumAllowedMapboxTiles:)]) {
[pack.delegate offlinePack:pack didReceiveMaximumAllowedMapboxTiles:limit];
}