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

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

Merged
jfirebaugh merged 2 commits into
masterfrom
fix-6092
May 2, 2018
Merged

jfirebaugh merged 2 commits into
masterfrom
fix-6092

Conversation

@jfirebaugh

Copy link
Copy Markdown
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

@1ec5 1ec5 left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread platform/darwin/src/MGLOfflinePack.mm Outdated
@end

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

Copy link
Copy Markdown
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
Copy Markdown
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