Skip to content
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 crash with switching terrain provider and picking #6918

Merged
merged 3 commits into from
Aug 14, 2018
Merged

Conversation

hpinkos
Copy link
Contributor

@hpinkos hpinkos commented Aug 14, 2018

Fixes #6916

The crash was caused when things happen in the following order:

  1. When a new terrain provider is set, QuadtreePrimitive._invalidateAllTiles is set to true
  2. scene.render is called, which queues commands, including the commands for the soon-to-be invalidated GlobeSurfaceTiles. QuadtreePrimitive actually invalidates these tiles at the end of the frame.
  3. scene.pick is called. It uses the same commands from the last render, which now includes commands for tiles that were freed at the end of the frame. This causes a crash because the vertex arrays for these commands have been destroyed.

Moving invalidateAllTiles to frameStart instead of frameEnd prevents the commands for the invalid tiles from being added to the command queue.

@hpinkos hpinkos requested a review from bagnell August 14, 2018 17:20
@cesium-concierge
Copy link

Thanks for the pull request @hpinkos!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@bagnell
Copy link
Contributor

bagnell commented Aug 14, 2018

Update CHANGES.md.

Your reason for the crash and the code changes look good to me, but I couldn't reproduce the crash in master. Can someone else confirm this fixed the issue? @lilleyse @mramato?

@hpinkos
Copy link
Contributor Author

hpinkos commented Aug 14, 2018

@bagnell yeah it's really difficult to reproduce with the code sample I included in #6916 but I can reproduce it easily in another project if you want to test that out

@bagnell
Copy link
Contributor

bagnell commented Aug 14, 2018

OK, I can confirm this fixes the issue. Thanks @hpinkos.

@bagnell bagnell merged commit a8d38aa into master Aug 14, 2018
@bagnell bagnell deleted the fix-tile-crash branch August 14, 2018 21:20
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.

3 participants