ToolbarHUD.dispose leaves btnMeshes so stale clicks still fire #1090

Closed
opened 2026-08-13 13:55:59 +00:00 by spikerj · 1 comment
Owner

Found while adding Wave 8 leftover coverage for toolbar-hud.ts.

dispose() releases the texture cache and clearGroup()s, but does not null btnMeshes / keyTexts (CompletionHUD and HintHUD do clear their hit targets).

After dispose:

  • handleClick still AABB-hits the disposed button meshes and invokes onButtonClick (score/minimap/settings/etc. can toggle after teardown)
  • setHotkeys writes .text / .sync() onto disposed troika Texts
  • an in-flight TextureLoader.load callback still textureCache.sets and addIconMeshes onto the torn-down group; those textures are never disposed

Suggested fix: this.btnMeshes = []; this.keyTexts = []; this.onButtonClick = null; in dispose, and guard the load callback with a disposed flag (or compare textureCache membership after a clear).

Found while adding Wave 8 leftover coverage for `toolbar-hud.ts`. `dispose()` releases the texture cache and `clearGroup()`s, but does **not** null `btnMeshes` / `keyTexts` (CompletionHUD and HintHUD do clear their hit targets). After dispose: - `handleClick` still AABB-hits the disposed button meshes and invokes `onButtonClick` (score/minimap/settings/etc. can toggle after teardown) - `setHotkeys` writes `.text` / `.sync()` onto disposed troika Texts - an in-flight `TextureLoader.load` callback still `textureCache.set`s and `addIconMesh`es onto the torn-down group; those textures are never disposed Suggested fix: `this.btnMeshes = []; this.keyTexts = []; this.onButtonClick = null;` in `dispose`, and guard the load callback with a disposed flag (or compare `textureCache` membership after a clear).
Author
Owner

Resolved in spikersoft-angular PR #819 (merged to master). ToolbarHUD.dispose clears btnMeshes so stale clicks cannot fire. Closing.

Resolved in spikersoft-angular [PR #819](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/819) (merged to `master`). ToolbarHUD.dispose clears btnMeshes so stale clicks cannot fire. Closing.
Sign in to join this conversation.