mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Fix errors caused by reusing previously freed objects(skeletonInfo.skeleton) (#16605)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user