fix: release GIF ref on sprite destroy to prevent gifCache leak
Override destroy() in AnimatedGifSprite to call releaseGif() when a loaded GIF item is deleted from the board. Without this, the gifCache refCount stays elevated until full canvas teardown.
This commit is contained in:
@@ -128,6 +128,19 @@ export class AnimatedGifSprite extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
/** Release ref-counted GIF source on destroy (handles deletion while loaded). */
|
||||
override destroy(options?: any): void {
|
||||
if (this.loaded) {
|
||||
if (this._gif) {
|
||||
this._gif.stop();
|
||||
this._playing = false;
|
||||
}
|
||||
this.textures.releaseGif(this.assetKey);
|
||||
this.loaded = false;
|
||||
}
|
||||
super.destroy(options);
|
||||
}
|
||||
|
||||
/** Unload GIF to free memory (ref-counted). Called by viewport culling. */
|
||||
unloadTexture(): void {
|
||||
if (!this.loaded) return;
|
||||
|
||||
Reference in New Issue
Block a user