fix(refboard): reference-counted textures prevent shared source crash

When duplicated images share the same assetKey, Assets.unload()
was destroying the shared texture source — crashing all sprites
using it (null addressModeU/alphaMode in WebGL renderer).

TextureManager now tracks refCount per asset. Only calls
Assets.unload() when the last reference is released. ImageSprite
calls release() instead of unload() on texture teardown.
This commit is contained in:
Hiren Kangad
2026-03-10 11:12:21 +05:30
parent 1ffb7e9d41
commit 9716beee8a
2 changed files with 36 additions and 12 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ export class ImageSprite extends Container {
unloadTexture(): void {
if (!this.loaded) return;
this.textures.unload(this.assetKey);
this.textures.release(this.assetKey);
// Remove sprite from display tree entirely — avoids PixiJS v8 render crash
if (this._sprite) {