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

Fix hang observing user defaults on background queue #4745

Merged
merged 3 commits into from
Apr 19, 2016

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Apr 19, 2016

Fixed a deadlock that could occur if the host application attempts to set user defaults on a background queue. Now we observe user defaults changes synchronously.

/cc @jfirebaugh @boundsj

Fixed a deadlock that could occur if the host application attempts to set user defaults on a background queue. Now we observer user defaults changes synchronously.
@1ec5 1ec5 self-assigned this Apr 19, 2016
@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS crash telemetry Integration with Mapbox Telemetry libraries labels Apr 19, 2016
@1ec5 1ec5 added this to the ios-v3.3.0 milestone Apr 19, 2016
@boundsj
Copy link
Contributor

boundsj commented Apr 19, 2016

👍

@@ -249,6 +239,11 @@ - (NSString *)instanceID {
return _instanceID;
}

- (void)userDefaultsDidChange:(NSNotification *)notification {
MGLAssertIsMainThread();

Choose a reason for hiding this comment

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

Why the assert here? Could pauseOrResumeMetricsCollectionIfRequired not just be dispatched back onto main thread if needed instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Fixed in 3c4049c.

@1ec5
Copy link
Contributor Author

1ec5 commented Apr 19, 2016

One-off build and podspec for verification.

@1ec5 1ec5 merged commit 3c4049c into master Apr 19, 2016
@1ec5 1ec5 deleted the 1ec5-defaults-queue-2 branch April 19, 2016 16:58
@1ec5
Copy link
Contributor Author

1ec5 commented Apr 20, 2016

Cherry-picked into 3.2.1 as b8ecbf6...78ddcd7.

@friedbunny friedbunny modified the milestones: ios-v3.2.1, ios-v3.3.0 Apr 21, 2016
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 telemetry Integration with Mapbox Telemetry libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants