Skip to content

fix(layers): drop the deleted texture in IconManager.finalize - #10810

Merged
chrisgervang merged 2 commits into
visgl:masterfrom
javandres:fix/icon-manager-finalize-texture
Oct 29, 2026
Merged

chrisgervang merged 2 commits into
visgl:masterfrom
javandres:fix/icon-manager-finalize-texture

Conversation

@javandres

@javandres javandres commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

fix(layers): drop the deleted texture in IconManager.finalize

IconManager.finalize() deletes its texture but keeps the reference to it. Icons still loading when
the layer is finalized resolve afterwards and run this._texture?.copyExternalImage(...) against the
deleted texture, so each one logs WebGL: INVALID_OPERATION: bindTexture: attempt to use a deleted object and the mipmap regeneration that follows. The load callback already skips the write when
_texture is null, which is how the iconAtlas branch of setProps leaves it after deleting.

In an application that replaces an auto-packing IconLayer while its icons are still downloading we
counted 8 of these warnings per replacement; none with this change.

Change List

  • IconManager.finalize: set _texture to null after deleting it
  • Unit test: a load that resolves after finalize does not write into the deleted texture

Note

Low Risk
Narrow lifecycle fix in icon atlas loading with a regression test; no API or security surface change.

Overview
Fixes WebGL INVALID_OPERATION: bindTexture noise when an auto-packing IconLayer is torn down while icon fetches are still in flight.

IconManager.finalize() already deleted the atlas texture but left _texture pointing at it; late load callbacks still called copyExternalImage and mipmap regeneration on that handle. After delete, _texture is set to null, matching the iconAtlas path in setProps, so pending loads no-op via the existing optional chaining.

Adds a unit test that finalizes with a load pending and asserts the completed load does not write to the deleted texture and getTexture() is null.

Reviewed by Cursor Bugbot for commit 3b28714. Bugbot is set up for automated code reviews on this repo. Configure here.

finalize() deleted the texture but kept the reference. Icons still
loading when the layer was finalized resolved afterwards and copied
into the deleted texture, logging a WebGL INVALID_OPERATION per icon.
The load callback already skips the write when _texture is null, as
setProps leaves it when an iconAtlas replaces the packed one.
@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Clears the deleted texture reference in IconManager.finalize() so pending icon loads skip writes to it.

  • Finalizing an icon layer clears its atlas before late images finish.

Reviews (2) · Last reviewed commit: "Merge branch 'master' into fix/icon-mana..." · Reviewed by Greptile

@chrisgervang chrisgervang mentioned this pull request Oct 29, 2026
29 of 30 tasks
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 29, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 84.355% (+0.004%) from 84.351% — javandres:fix/icon-manager-finalize-texture into visgl:master

@chrisgervang
chrisgervang merged commit e76e540 into visgl:master Oct 29, 2026
9 checks passed
chrisgervang added a commit that referenced this pull request Nov 3, 2026
finalize() deleted the texture but kept the reference. Icons still
loading when the layer was finalized resolved afterwards and copied
into the deleted texture, logging a WebGL INVALID_OPERATION per icon.
The load callback already skips the write when _texture is null, as
setProps leaves it when an iconAtlas replaces the packed one.

Co-authored-by: Chris Gervang <[email protected]>
(cherry picked from commit e76e540)
@chrisgervang

Copy link
Copy Markdown
Collaborator

Released in deck.gl 9.4.2. Thanks @javandres!

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