Skip to content

Fix a potential crash after destroying a node with Spine Skeleton Component in schedule update on native platforms.#18567

Merged
dumganhar merged 5 commits intococos:v3.8.7from
bofeng-song:387_spine_bug
Apr 9, 2025
Merged

Fix a potential crash after destroying a node with Spine Skeleton Component in schedule update on native platforms.#18567
dumganhar merged 5 commits intococos:v3.8.7from
bofeng-song:387_spine_bug

Conversation

@bofeng-song
Copy link
Contributor

@bofeng-song bofeng-song commented Apr 7, 2025

Re: #
#18555
#18561

https://forum.cocos.org/t/topic/165212/629

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@bofeng-song bofeng-song requested a review from dumganhar April 7, 2025 06:24
@github-actions
Copy link

github-actions bot commented Apr 7, 2025

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1002457 bytes 1002457 bytes ✅ 0 bytes
2D All (legacy pipeline) 2664618 bytes 2664618 bytes ✅ 0 bytes
2D All (new pipeline) 2752826 bytes 2752826 bytes ✅ 0 bytes
(2D + 3D) All 10006413 bytes 10006413 bytes ✅ 0 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16920829 bytes 16920829 bytes ✅ 0 bytes

Interface Check Report

This pull request does not change any public interfaces !

if (!_skeleton) return;
auto *entity = _entity;
// entity's node may be set to nullptr while component is destroyed.
if (!entity || !entity->getNode()) return;
Copy link
Contributor

@finscn finscn Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

276行改为

if (!_entity || !_entity->getNode()) return;

并且放到 274行上面更合适吧? 和 SkeletonCacheAnimation.cpp 里的逻辑保持一致

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

效果是一样的,此处多一个赋值不会产生什么开销

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

效果是一样的,此处多一个赋值不会产生什么开销

我知道不会产生什么开销. 我只是觉得代码的思路应该一致, 这样代码更优雅一些.

@dumganhar dumganhar changed the title Fix Spine crash caused by deferredDestroy-triggered native object delay release after update. Fix a potential crash after destroying a node with Spine Skeleton Component in schedule update. Apr 9, 2025
@dumganhar dumganhar changed the title Fix a potential crash after destroying a node with Spine Skeleton Component in schedule update. Fix a potential crash after destroying a node with Spine Skeleton Component in schedule update on native platforms. Apr 9, 2025
@dumganhar dumganhar merged commit a9c8227 into cocos:v3.8.7 Apr 9, 2025
33 checks passed
AILHC added a commit to AILHC/cocos-engine that referenced this pull request May 19, 2025
@bofeng-song bofeng-song deleted the 387_spine_bug branch May 19, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants