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

Ignore progress updates after suspending #6186

Merged
merged 1 commit into from
Sep 21, 2016

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Aug 27, 2016

This is a cosmetic fix that makes an offline pack appear to stop downloading as soon as -suspend is called on it.

Note that this change does not address the crash in #6092, which occurs because the MBGLOfflineRegionObserver’s weak pointer to the MGLOfflinePack object has gone stale by the time late notifications come in from the mbgl::OfflineRegion. MBGLOfflineRegionObserver is owned by mbgl::OfflineRegion and MGLOfflinePack doesn’t currently have a reference to it, although that might be one future direction for improvement.

Fixes #5538.

/cc @jfirebaugh

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS offline labels Aug 27, 2016
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Aug 27, 2016
@1ec5 1ec5 self-assigned this Aug 27, 2016
@mention-bot
Copy link

@1ec5, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh to be potential reviewers.

@jfirebaugh
Copy link
Contributor

I'll delegate review here to someone more familiar with platform/darwin code.

@1ec5
Copy link
Contributor Author

1ec5 commented Sep 21, 2016

@boundsj @incanus, does this look safe and effective to you?

@@ -93,6 +95,11 @@ - (void)resume {
- (void)suspend {
MGLAssertOfflinePackIsValid();

if (self.state == MGLOfflinePackStateActive) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does resume need to set _isSuspending to NO? I'm not certain but it seems like a resumed offline pack may no longer report progress even if the state is set to MGLOfflinePackStateActive because of a region status change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3b546b9.

Copy link
Contributor

@boundsj boundsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the question about the case of suspend, this looks good to me.

@1ec5 1ec5 force-pushed the 1ec5-offline-suspend-progress-5538 branch from adf5733 to 3fb254b Compare September 21, 2016 04:51
-suspend and -resume are now presumed to be synchronous, even if technically they remain asynchronous under the hood.
@1ec5 1ec5 force-pushed the 1ec5-offline-suspend-progress-5538 branch from 3fb254b to 3b546b9 Compare September 21, 2016 05:35
@1ec5 1ec5 merged commit 3b546b9 into master Sep 21, 2016
@1ec5 1ec5 deleted the 1ec5-offline-suspend-progress-5538 branch September 21, 2016 07:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS offline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop delivering status updates when offline download is canceled
4 participants