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

Don't call initialize twice when getStyle callback fires several times. #1112

Merged
merged 3 commits into from
Feb 7, 2022

Conversation

yunikkk
Copy link
Contributor

@yunikkk yunikkk commented Feb 2, 2022

This PR fixes possible crash with Location persistent layer being added twice.
This had happened for 1tap, for example.

Summary of changes

User impact (optional)

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Optimize code for java consumption (@JvmOverloads, @file:JvmName, etc).
  • Add example if relevant.
  • Document any changes to public APIs.
  • Apply changelog label ('breaking change', 'bug 🪲', 'build', 'docs', 'feature 🍏', 'performance ⚡', 'testing 💯') or use the label 'skip changelog'
  • Add an entry inside this element for inclusion in the mapbox-maps-android changelog: <changelog>Fix crash within location plugin that happens when style is reloaded simultaneously with location plugin updates.</changelog>.
  • If this PR is a v10.[version] release branch fix / enhancement, merge it to main firstly and then port to v10.[version] release branch.

Fixes: < Link to related issues that will be fixed by this pull request, if they exist >

PRs must be submitted under the terms of our Contributor License Agreement CLA.

@yunikkk yunikkk requested a review from a team February 2, 2022 13:45
@@ -49,20 +49,22 @@ internal class LocationPuckManager(
}

fun initialize(style: StyleInterface) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initialize method called from updateSettings waits for the style at getStyle.
If updateSettings was called multiple times multiple callbacks will fire after style arrives causing crash.

@yunikkk yunikkk added the bug 🪲 Something isn't working label Feb 4, 2022
@kiryldz
Copy link
Contributor

kiryldz commented Feb 4, 2022

Missing update changelog and guess it would be nice to add a bit more details about the issue we're fixing here as current entry is very high-level

@yunikkk yunikkk force-pushed the yds-fix-location-layer-added-twice branch from 9486246 to ce4b6f4 Compare February 4, 2022 16:23
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Kiryl Dzehtsiarenka <kiryl.dzehtsiarenka@mapbox.com>
@yunikkk yunikkk merged commit b05fa61 into main Feb 7, 2022
@yunikkk yunikkk deleted the yds-fix-location-layer-added-twice branch February 7, 2022 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants