Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in -[BugsnagSystemState sync] #893

Merged
merged 2 commits into from
Nov 18, 2020

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Nov 17, 2020

Goal

The crash was reported against -[BugsnagSystemState sync] + 203 (BugsnagSystemState.m:203) which is retaining the currentLaunchState property.

- (void)sync {
    NSDictionary *state = self.currentLaunchState;
    NSError *error = nil;
    ...

This crashed because currentLaunchState was declared nonatomic but is being set and read from different threads.

Changeset

  • Made the currentLaunchState property atomic - this ensures the returned object will not be deallocated by a setting thread before the getter completes.
  • Marked other nonatomic properties as readonly where appropriate to avoid similar issues being introduced in the future.

Testing

N/A

@nickdowell nickdowell merged commit 09a4446 into next Nov 18, 2020
@nickdowell nickdowell deleted the nickdowell/fix-crash-in-systemstate branch November 18, 2020 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants