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

Don't add polyline to update list twice #7155

Merged
merged 5 commits into from
Oct 19, 2018
Merged

Don't add polyline to update list twice #7155

merged 5 commits into from
Oct 19, 2018

Conversation

hpinkos
Copy link
Contributor

@hpinkos hpinkos commented Oct 16, 2018

Fixes #7153

@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.

🌍 🌎 🌏

@mramato
Copy link
Contributor

mramato commented Oct 16, 2018

I'm pretty certain this exact code (or something like it) used to use indexOf and we changed it because it's a major performance killer. You are basically doing a linear search for every polyline being updated.

What is the root problem here, we are essentially updating the line twice and that leads to an error? Could we avoid the indexOf by using a dirty flag and simply not doing the second update if it's already been called?

@hpinkos
Copy link
Contributor Author

hpinkos commented Oct 16, 2018

Good call @mramato, I didn't realize polyline had a dirty flag.

@mramato
Copy link
Contributor

mramato commented Oct 16, 2018

I didn't realize polyline had a dirty flag.

I didn't either, glad it was that easy 😄 That being said, it would it make more sense to add this check in Polyline.js itself, that way it avoids calling _updatePolyline at all if it's already dirty?

@hpinkos
Copy link
Contributor Author

hpinkos commented Oct 16, 2018

@mramato no, I don't think that will work because the polyline might have multiple properties changed and the _propertiesChanged array in PolylineCollection still needs to be incremented.

@mramato
Copy link
Contributor

mramato commented Oct 16, 2018

Good call. That makes sense. Should we add a unit test for this?

@bagnell can you review and merge? Thanks.

@bagnell
Copy link
Contributor

bagnell commented Oct 16, 2018

Looks good to me. Can you add a test @hpinkos?

@hpinkos
Copy link
Contributor Author

hpinkos commented Oct 16, 2018

@bagnell ready

@bagnell bagnell merged commit c18646a into master Oct 19, 2018
@bagnell bagnell deleted the fix-polyline-crash branch October 19, 2018 17:13
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.

4 participants