WeaponsHUD.render leaves autoClear=false when render() throws; dispose rebuilds #1076

Closed
opened 2026-08-13 13:33:26 +00:00 by spikerj · 1 comment
Owner

WeaponsHUD.render sets renderer.autoClear = false, then clearDepth() + render(), then restores autoClear.

If renderer.render throws, the restore is skipped (it sits after render() inside the same try, and the catch only console.errors). Callers that share the renderer then draw the next pass with autoClear === false and leave uncleared colour buffers.

dispose() is also wrong: it calls rebuildUI() (which recreates the bar) and then drops the tracking arrays, so the group still has live meshes after dispose.

File: projects/spikersoft/src/app/_components/_games/space-game/hud/weapons-hud.ts (render / dispose).

`WeaponsHUD.render` sets `renderer.autoClear = false`, then `clearDepth()` + `render()`, then restores `autoClear`. If `renderer.render` throws, the restore is skipped (it sits after `render()` inside the same `try`, and the `catch` only `console.error`s). Callers that share the renderer then draw the next pass with `autoClear === false` and leave uncleared colour buffers. `dispose()` is also wrong: it calls `rebuildUI()` (which *recreates* the bar) and then drops the tracking arrays, so the group still has live meshes after dispose. File: `projects/spikersoft/src/app/_components/_games/space-game/hud/weapons-hud.ts` (`render` / `dispose`).
Author
Owner

Resolved in spikersoft-angular PR #819 (merged to master). WeaponsHUD restores autoClear in finally; dispose tears down instead of rebuilding. Closing.

Resolved in spikersoft-angular [PR #819](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/819) (merged to `master`). WeaponsHUD restores autoClear in finally; dispose tears down instead of rebuilding. Closing.
Sign in to join this conversation.