From 73ed8aa7be5dbb9793e44e2bc981fefbed3807bc Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Sat, 18 Mar 2017 19:09:45 -0700 Subject: [ios] Guard against over calling pause or resume --- platform/darwin/src/MGLOfflineStorage.mm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'platform') 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 -- cgit v1.2.1