Skip to content

fix: clean up showsUpdated on entity removal in ground batches (#9370)#13366

Open
chalabi2 wants to merge 3 commits intoCesiumGS:mainfrom
chalabi2:fix/stale-shows-updated-on-entity-removal
Open

fix: clean up showsUpdated on entity removal in ground batches (#9370)#13366
chalabi2 wants to merge 3 commits intoCesiumGS:mainfrom
chalabi2:fix/stale-shows-updated-on-entity-removal

Conversation

@chalabi2
Copy link
Copy Markdown

@chalabi2 chalabi2 commented Apr 5, 2026

Description

  • Add missing this.showsUpdated.remove(id) in Batch.prototype.remove for both StaticGroundPolylinePerMaterialBatch and StaticGroundGeometryPerMaterialBatch
  • When an entity's isShowing property changes and the entity is removed before the next render, updateShows iterates a stale entry, calls this.geometry.get(updater.id) on a removed entity, and crashes with Cannot read properties of undefined (reading 'id')
  • Adds regression tests to both spec files that reproduce the exact crash scenario: add entity → trigger show change → remove entity → update batch

Issue number and link

#9370

Testing plan

  • Existing StaticGroundPolylinePerMaterialBatchSpec tests pass
  • Existing StaticGroundGeometryPerMaterialBatchSpec tests pass
  • New test "does not crash when removing an entity with a pending show update" passes in both specs
  • Manual: toggle entity.show, then remove entity before next frame — no crash

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

AI acknowledgment

  • I used AI to generate content in this PR
  • If yes, I have reviewed the AI-generated content before submitting

If yes, I used the following Tools(s) and/or Service(s):

If yes, I used the following Model(s):

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Thank you for the pull request, @chalabi2!

✅ We can confirm we have a CLA on file for you.

chalabi2 added 2 commits April 6, 2026 11:00
…mGS#9370)

When an entity's `isShowing` changes, the updater is queued in
`showsUpdated`. `Batch.prototype.remove` did not clean up this
collection, leaving stale entries that cause `updateShows` to crash
with "Cannot read properties of undefined (reading 'id')" on the
next render frame.

Add `this.showsUpdated.remove(id)` to `Batch.prototype.remove` in
both `StaticGroundPolylinePerMaterialBatch` and
`StaticGroundGeometryPerMaterialBatch`, consistent with existing
cleanup for `subscriptions` and `updatersWithAttributes`.

Fixes CesiumGS#9370
@chalabi2 chalabi2 force-pushed the fix/stale-shows-updated-on-entity-removal branch from 825212a to 2749cd9 Compare April 6, 2026 18:00
@chalabi2
Copy link
Copy Markdown
Author

chalabi2 commented Apr 8, 2026

this is ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant