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

Delete palette texture before creating a new context #15787

Merged
merged 2 commits into from May 1, 2024

Conversation

tschaub
Copy link
Member

@tschaub tschaub commented Apr 30, 2024

When a WebGL layer is removed and the helper is disposed, we need to stop using any textures or other resources bound to the associated context. This change makes it so palette textures used in rendering tiles are deleted from a context before that context is disposed.

I'll admit I'm not totally happy with the regression test. Without the timeouts, removing and adding the layer does not trigger the error (in the main branch). I tried adding map.renderSync() calls between, but couldn't get things to fail without waiting a while between the initial render and the remove/add.

Fixes #15786.

Copy link

📦 Preview the website for this branch here: https://deploy-preview-15787--ol-site.netlify.app/.

Copy link
Member

@ahocevar ahocevar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! You may want to consider my suggestion to use a rendercomplete listener instead of a setTimeout.

test/rendering/cases/cog-palette-add-remove/main.js Outdated Show resolved Hide resolved
Co-authored-by: Andreas Hocevar <andreas.hocevar@gmail.com>
@tschaub tschaub merged commit d95726b into openlayers:main May 1, 2024
8 checks passed
@tschaub tschaub deleted the palette branch May 1, 2024 12:25
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.

WebGLTileLayer with palette style stops working after map.removeLayer/map.addLayer
2 participants