From d84d668450b628db22a6e96c089bea5151ace657 Mon Sep 17 00:00:00 2001 From: bofeng-song Date: Mon, 24 Mar 2025 18:20:34 +0800 Subject: [PATCH] Fix spine crash when exiting game. (#18506) It's a bug after merging https://github.com/cocos/cocos-engine/pull/18467 --- .../spine-creator-support/SkeletonCacheAnimation.cpp | 1 + .../editor-support/spine-creator-support/SkeletonRenderer.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp index 4be31e22a7b..d6cfdf43ed9 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp +++ b/native/cocos/editor-support/spine-creator-support/SkeletonCacheAnimation.cpp @@ -85,6 +85,7 @@ SkeletonCacheAnimation::~SkeletonCacheAnimation() { for (auto &item : _materialCaches) { CC_SAFE_DELETE(item.second); } + _entity = nullptr; stopSchedule(); } diff --git a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp index b2ccd6e57da..82850398164 100644 --- a/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp +++ b/native/cocos/editor-support/spine-creator-support/SkeletonRenderer.cpp @@ -174,6 +174,7 @@ SkeletonRenderer::~SkeletonRenderer() { CC_SAFE_DELETE(item.second); } + _entity = nullptr; stopSchedule(); }