fix(ios): prevent crash on Google Maps animated gradient polyline#84
Merged
Conversation
Clear GMSPolyline spans before swapping a shorter path so Google Maps never rebuilds span models against missing segments (GMSModelStyleBuilder couldNotInstantiate -> EXC_BAD_ACCESS). Guard zero-segment paths and drop duplicate adjacent coordinates in both animated and static updates. Gradient rendering is preserved.
Slice the animated route ahead of the moving truck so the polyline coordinates mutate mid-animation, mirroring the live-route scenario from the Mover crash. Bumps example Podfile.lock to beta.16.
This file contains hidden or 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
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.
Fixes ENG-1150.
Summary
Fixes a native iOS crash (
EXC_BAD_ACCESS/GMSModelStyleBuilder couldNotInstantiate) on animated Google Maps gradient polylines, surfaced by TestFlight crash reports in the Lugg Mover app (ENG-1150).Each display-link tick assigned
_polyline.path = paththen_polyline.spans = spans. Setting the new (shorter) path while the previous tick's spans were still attached makes Google Maps rebuild span models for segments that no longer exist → throws inGMSModelStyleBuilder. The empty-path branch (headDist <= tailDist) was the worst case: it shrank the path to empty but left stale spans.The fix preserves the gradient rather than falling back to a solid stroke:
_polyline.spans = nilbefore swapping to a shorter/empty path, then reassign spans once the new path is set, so path and spans are never inconsistent.updatepath;createGradientSpansnow keys off the deduped path's actual segment count.Also adds an example smoke test: the gradient route is sliced to the path ahead of the moving truck, so
coordinatesmutate mid-animation — mirroring the live-route scenario from the crash.Type of Change
Test Plan
Screenshots / Videos
N/A
Checklist