-
Notifications
You must be signed in to change notification settings - Fork 97
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
Fixed race conditions in AnimatedRoute #246
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…sly used both, and ' is preferred in the dart style guide.
…onsidered "dynamic", and improves IDE/linting. This could be avoided by using `super.id` but that's not supported in Dart pre 2.17.0. I also didn't notice until finishing that these files are generated, but its unclear what generates them.
…re it's been set. This is due to pointAnnotationManager requiring async to load, and setStyle callback being called before it loaded. The simpliest fix was just to move the setStyle callback code into the _onMapCreated callback as it was possible to set everything up in there. There is still a subtle race if a user presses car_detailed FloatingActionButton button. I think the correct fix is to disable that button until loading is done.
…multiple times, the StyleLayer would be removed, but the Tween animation would still try and update it. I also simplified the code a little, as the style was inconsient with above, and had a branch that could never be visited.
evil159
approved these changes
Apr 29, 2024
evil159
added a commit
that referenced
this pull request
Apr 29, 2024
* Changed the file to consistently use ' instead of ". The file previously used both, and ' is preferred in the dart style guide. * Listed the parameter's types in the constructor so they wouldn't be considered "dynamic", and improves IDE/linting. This could be avoided by using `super.id` but that's not supported in Dart pre 2.17.0. I also didn't notice until finishing that these files are generated, but its unclear what generates them. * There is a race-condition where pointAnnotationManager is called before it's been set. This is due to pointAnnotationManager requiring async to load, and setStyle callback being called before it loaded. The simpliest fix was just to move the setStyle callback code into the _onMapCreated callback as it was possible to set everything up in there. There is still a subtle race if a user presses car_detailed FloatingActionButton button. I think the correct fix is to disable that button until loading is done. * Fixed another race condition, where if a PointAnnotation was clicked multiple times, the StyleLayer would be removed, but the Tween animation would still try and update it. I also simplified the code a little, as the style was inconsient with above, and had a branch that could never be visited. --------- Co-authored-by: Roman Laitarenko <roman.laitarenko@mapbox.com>
3 tasks
evil159
added a commit
that referenced
this pull request
Apr 30, 2024
* Changed the file to consistently use ' instead of ". The file previously used both, and ' is preferred in the dart style guide. * Listed the parameter's types in the constructor so they wouldn't be considered "dynamic", and improves IDE/linting. This could be avoided by using `super.id` but that's not supported in Dart pre 2.17.0. I also didn't notice until finishing that these files are generated, but its unclear what generates them. * There is a race-condition where pointAnnotationManager is called before it's been set. This is due to pointAnnotationManager requiring async to load, and setStyle callback being called before it loaded. The simpliest fix was just to move the setStyle callback code into the _onMapCreated callback as it was possible to set everything up in there. There is still a subtle race if a user presses car_detailed FloatingActionButton button. I think the correct fix is to disable that button until loading is done. * Fixed another race condition, where if a PointAnnotation was clicked multiple times, the StyleLayer would be removed, but the Tween animation would still try and update it. I also simplified the code a little, as the style was inconsient with above, and had a branch that could never be visited. --------- Co-authored-by: Andrew Brampton <github@bramp.net>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There were two easy to trigger race conditions in AnimatedRoute:
I fixed them, cleaned up the example, and cleaned up some related files.
There are however some subtle race conditions still, for example
Could fail if the style is deleted between the styleSourceExists and removeStyleSource calls. However, I felt it was better to keep the code a little error prone, then to muddle a lot of mutex, or wrap everything in exception handling.