summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2017-03-18 19:09:45 -0700
committerGitHub <noreply@github.com>2017-03-18 19:09:45 -0700
commit73ed8aa7be5dbb9793e44e2bc981fefbed3807bc (patch)
tree54a154a42694c1d46c83430d7ac832edf24a273a
parente4981d5bd0445a345673ee6ac5822128691003a0 (diff)
downloadqtlocation-mapboxgl-73ed8aa7be5dbb9793e44e2bc981fefbed3807bc.tar.gz
[ios] Guard against over calling pause or resume
-rw-r--r--include/mbgl/storage/default_file_source.hpp3
-rw-r--r--platform/darwin/src/MGLOfflineStorage.mm9
2 files changed, 9 insertions, 3 deletions
diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp
index 9262e0a1bc..db3bff5cd6 100644
--- a/include/mbgl/storage/default_file_source.hpp
+++ b/include/mbgl/storage/default_file_source.hpp
@@ -120,9 +120,6 @@ public:
*
* If pause is called then no revalidation or network request activity
* will occur.
- *
- * Note: Calling pause and then calling getAPIBaseURL or getAccessToken
- * will lock the thread that those calls are made on.
*/
void pause();
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm
index b65932c6e8..195ef3c36a 100644
--- a/platform/darwin/src/MGLOfflineStorage.mm
+++ b/platform/darwin/src/MGLOfflineStorage.mm
@@ -31,6 +31,7 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
@property (nonatomic, strong, readwrite) NS_MUTABLE_ARRAY_OF(MGLOfflinePack *) *packs;
@property (nonatomic) mbgl::DefaultFileSource *mbglFileSource;
+@property (nonatomic, getter=isPaused) BOOL paused;
@end
@@ -53,11 +54,19 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
- (void)pauseFileSource:(__unused NSNotification *)notification {
+ if (self.isPaused) {
+ return;
+ }
_mbglFileSource->pause();
+ self.paused = YES;
}
- (void)unpauseFileSource:(__unused NSNotification *)notification {
+ if (!self.isPaused) {
+ return;
+ }
_mbglFileSource->resume();
+ self.paused = NO;
}
#endif