Memory access out of bounds in spine 4.2
Cocos Creator version
3.8.7
System information
Windows 11
Issue description
Memory access out of bounds error in spine 4.2 when setting complete listener in onLoad() with 0 frame animation playing by default and accessing trackEntry.animation.name in listener callback
Relevant error log output
RuntimeError: memory access out of bounds
at null.
Steps to reproduce
Steps to reproduce:
1 - create a prefab with sp.Skeleton component attached 2 - set a 0 frame animation on the skeleton component on the prefab to play automatically when instantiated 3 - attach a script that will set a listener via skeleton.setCompleteListener in onLoad() function and access the trackEntry.animation.name property 3 - instantiate the prefab and set parent to add to scene 4 - observe the error
onLoad(): void {
this.skeleton.setCompleteListener((data) => {
switch (data.animation.name) { // will cause the error
case 'impact':
this.setIdle();
break;
case 'match':
this._matchResolve();
this.setIdle();
break;
}
});
}
Minimal reproduction project
No response
Please have a try: 1.switch spine version in project setting. 2.close project, delete library and temp. 3.open the project again.
try this PR: https://github.com/cocos/cocos-engine/pull/19041
@Arenooo Could you upload your demo?
@Arenooo @finscn @tangkaikk Synchronized the official code, SkeletonBinary It is necessary to check the resources for any slots that lack attachments.
@Arenooo @finscn @tangkaikk Synchronized the official code, SkeletonBinary It is necessary to check the resources for any slots that lack attachments.
这个 代码我合过来了. 但是感觉和现在的差异很大, 不知道里面是不是有 cocos 不需要的代码.
另外, 还是建议合并一下我这个 PR #19041 . 我是合并这个之后 问题就解决了. 不合并这个 有点类似于无限嵌套调用.