[ts][pixi-v7][pixi-v8] Clean up ticker correctly.

This commit is contained in:
Davide Tantillo 2026-02-24 11:56:13 +01:00
parent bbb07886cf
commit c24e19783c
2 changed files with 4 additions and 0 deletions

View File

@ -309,6 +309,7 @@ export class Spine extends Container {
}
/** Sets the ticker to use when {@link autoUpdate} is `true`. If `autoUpdate` is already `true`, the update callback will be moved from the old ticker to the new one. */
public set ticker (value: Ticker) {
value = value ?? Ticker.shared;
if (this._ticker === value) return;
if (this._autoUpdate) {
@ -405,6 +406,7 @@ export class Spine extends Container {
/** Destroy Spine game object elements, then call the {@link Container.destroy} with the given options */
public override destroy (options?: boolean | IDestroyOptions | undefined): void {
if (this.autoUpdate) this.autoUpdate = false;
(this._ticker as unknown) = null;
for (const [, mesh] of this.meshesCache) {
mesh?.destroy();
}

View File

@ -386,6 +386,7 @@ export class Spine extends ViewContainer {
}
/** Sets the ticker to use when {@link autoUpdate} is `true`. If `autoUpdate` is already `true`, the update callback will be moved from the old ticker to the new one. */
public set ticker (value: Ticker) {
value = value ?? Ticker.shared;
if (this._ticker === value) return;
if (this._autoUpdate) {
@ -1044,6 +1045,7 @@ export class Spine extends ViewContainer {
super.destroy(options);
this._ticker.remove(this.internalUpdate, this);
(this._ticker as unknown) = null;
this.state.clearListeners();
this.debug = undefined;
(this.skeleton as unknown) = null;