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

[ios, macos] Avoid implicit capture of MBGLOfflineRegionObserver this pointer #11821

Merged
merged 2 commits into from
May 2, 2018

Conversation

jfirebaugh
Copy link
Contributor

MBGLOfflineRegionObserver is owned by the offline database thread, and might be destroyed by the time the dispatch_async completes. Instead of implicitly capturing this, capture a copy of the MBGLOfflinePack weak pointer.

Speculatively fixes #6092.

… pointer

MBGLOfflineRegionObserver is owned by the offline database thread, and might be destroyed by the time the dispatch_async completes. Instead of implicitly capturing this, capture a copy of the MBGLOfflinePack weak pointer.
@jfirebaugh jfirebaugh requested a review from 1ec5 May 2, 2018 19:36
@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS offline crash labels May 2, 2018
Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

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

In addition to the comment below, this speculative fix should probably be mentioned in the changelogs, even if we qualify it as a speculative fix.

@@ -227,19 +227,22 @@ - (void)didReceiveMaximumAllowedMapboxTiles:(uint64_t)limit {
@end

void MBGLOfflineRegionObserver::statusChanged(mbgl::OfflineRegionStatus status) {
__weak MBGLOfflinePack *_pack = pack;
Copy link
Contributor

Choose a reason for hiding this comment

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

The class is called MGLOfflinePack, so the build is failing currently. The convention is to name the weak variable weakPack to more clearly distinguish the two variables.

@jfirebaugh
Copy link
Contributor Author

Seems like the changelog entry will be easiest to add in the cherry pick to release-boba. Adding it here would produce conflict during the cherry pick and then again when merging release-boba back to master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
crash 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.

Unrecognized selector crash when suspending and removing MGLOfflinePack
2 participants