Fix errors caused by reusing previously freed objects(skeletonInfo.skeleton) (#16605)

This commit is contained in:
bofeng-song
2023-12-13 16:54:46 +08:00
committed by GitHub
parent 1bdd90b5d3
commit 91dd0c76a0
+6
View File
@@ -353,6 +353,9 @@ export class Skeleton extends UIRenderer {
set skeletonData (value: SkeletonData | null) {
if (value) value.resetEnums();
if (this._skeletonData !== value) {
if (this._skeletonCache && this._skeletonData) {
this._skeletonCache.removeSkeleton(this._skeletonData.uuid);
}
this.destroyRenderData();
this._skeletonData = value as any;
this.defaultSkin = '';
@@ -712,6 +715,9 @@ export class Skeleton extends UIRenderer {
if (!JSB) {
spine.SkeletonSystem.destroySpineInstance(this._instance);
}
if (this._skeletonCache && this._skeletonData) {
this._skeletonCache.removeSkeleton(this._skeletonData.uuid);
}
super.onDestroy();
}
/**