Skip to content

CSMShadowNode: Fix error when disposed multiple times#33202

Merged
Mugen87 merged 1 commit intomrdoob:devfrom
shotamatsuda:fix/csm-double-dispose
Mar 18, 2026
Merged

CSMShadowNode: Fix error when disposed multiple times#33202
Mugen87 merged 1 commit intomrdoob:devfrom
shotamatsuda:fix/csm-double-dispose

Conversation

@shotamatsuda
Copy link
Copy Markdown
Contributor

This PR fixes CSMShadowNode throwing errors when disposed multiple times.

Disposing an instance multiple times may be invalid in itself, but it's better to be robust.

This happens when a CSMShadowNode is attached to a light's shadow, and the light and the CSM node are disposed independently.

const light = new DirectionalLight()
const csm = new CSMShadowNode()
light.shadow.shadowNode = csm

renderer.render() // Render a frame so that the CSM node is setup

light.dispose()
csm.dispose() // Error

@Mugen87 Mugen87 added this to the r184 milestone Mar 18, 2026
@Mugen87 Mugen87 merged commit 21ae313 into mrdoob:dev Mar 18, 2026
8 of 9 checks passed
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.

2 participants