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 condition with map#waitForMap #808
Conversation
@AAverin There is a good chance thats this solves that issue that as well. Would be great if you could test! |
@felix-ht Yes, I will try to test tomorrow against my codebase. Android was quite stable, but there were many issues on iOS |
@felix-ht Doesn't help with the animation issue I had, will do some more tests |
@felix-ht After all the fixes I did before onStyleLoaded is invoked quite stable for me, maybe I am just not catching some edge case. The only big issue I have is that calling camera with animation inside onStyleLoaded doesn't work. If you say that this PR resolves some minor edge case, let's merge it. |
https: //github.com/flutter-mapbox-gl/maps/pull/808 Co-Authored-By: Felix Horvat <24698503+felix-ht@users.noreply.github.com>
* Cherry-pick upstream#808 https: //github.com/flutter-mapbox-gl/maps/pull/808 Co-Authored-By: Felix Horvat <24698503+felix-ht@users.noreply.github.com>
Multiple attempts have been made to fix the the issue that sometimes on iOS
onStyleLoaded
has does not fire. #775However the error still seems to show up for some users - albeit very rarely.
With this PR im pretty confident to truly fix the issue.
The root cause seems to be that on the native side
onStyleLoaded
fires before the flutter code has even setup the platform callbacks. This causes mainly two kinds of issues:onMapCreated
andonStyleLoaded
being called out of orderonStyleLoaded
not being called at allTo fix it i changed the implementation so that map#waitForMap calls onStyleLoaded if on the map has already finished loading the style. If map#waitForMap happens first onStyleLoaded is called in the mapView callback.
On subsequent style changes mapView always directly calls onStyleLoaded.
@AAverin it would be great if you could check this code with your test code as well - to make sure that is gone for you as well.