-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 polyline update and removal bookkeeping #6455
Conversation
Fixes CesiumGS#4983. PolylineCollection stores a list of polylines that are waiting to be updated in the next render pass. However, if a polyline is both updated _and_ removed in the same synchronous execution sequence, _and_ the polyline is near the end of the collection's internal `this._polylines` list, it's possible for the PolylineCollection to effectively read off the end of the array, causing an error "Batch Table instanceIndex out of range". This is resolved by ensuring that removing a polyline from the collection also removes it from the list of polylines waiting to be updated.
Welcome to the Cesium community @markerikson! Can you please send in a Contributor License Agreement (CLA) so that we can review and merge this pull request?
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
CLA sent in, and updated CHANGES.md. |
The fix looks good to me! And we got your CLA email. Can you please write a unit test for this? |
Yeah, lemme figure out how the unit testing setup works on this project and do so. |
Unit test added. |
We received @markerikson's CLA. |
Looks like there's some style complaints. I'll fix those. |
@markerikson remember to add yourself to CONTRIBUTORS.md as well =) |
And looks like the CI check is clean. |
Great work @markerikson! Thanks so much for digging into this, I wasn't able to figure out what the issue was last time I looked at it. I just made a few minor styling changes. As soon as CI passes I'll merge this in. |
Great work @markerikson, thanks again! And congrats on your first Cesium contribution! |
Fixes #4983.
PolylineCollection stores a list of polylines that are waiting to be updated in the next render pass. However, if a polyline is both updated and removed in the same synchronous execution sequence, and the polyline is near the end of the collection's internal
this._polylines
list, it's possible for the PolylineCollection to effectively read off the end of the array, causing an error "Batch Table instanceIndex out of range".This is resolved by ensuring that removing a polyline from the collection also removes it from the list of polylines waiting to be updated.