cocos-engine icon indicating copy to clipboard operation
cocos-engine copied to clipboard

fix spine cache animation delete material cache bug

Open xinyangtan opened this issue 11 months ago • 4 comments

原生平台spine使用缓存时,在组件update时候进行操作可能会导致删除正在使用的材质信息,导致绘制访问异常内存而崩溃。

例如:

import { _decorator, Component, director, math, Node, sp } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Tester')
export class Tester extends Component {

    @property(sp.Skeleton)
    private skeleton: sp.Skeleton;

    update(deltaTime: number) {
        if (director.getTotalFrames() == 3) {
            this.skeleton.enabled = false;
            this.skeleton.setSkin("e yu");
            this.skeleton.enabled = true;
        }
    }
}

除update阶段,还存在其他一些阶段有问题,不列举了。

xinyangtan avatar Mar 09 '24 07:03 xinyangtan

Interface Check Report

This pull request does not change any public interfaces !

github-actions[bot] avatar Mar 09 '24 07:03 github-actions[bot]

@xinyangtan Could you upload a reproducible demo? I can't reproduce it locally with the information you provided.

bofeng-song avatar Apr 24 '24 09:04 bofeng-song

@xinyangtan Could you upload a reproducible demo? I can't reproduce it locally with the information you provided.

SpineShareCacheBug.zip @bofeng-song Use this project to build windows. it will crash when running.

xinyangtan avatar Apr 24 '24 11:04 xinyangtan

@xinyangtan Could you upload a reproducible demo? I can't reproduce it locally with the information you provided.

SpineShareCacheBug.zip @bofeng-song Use this project to build windows. it will crash when running.

I have supplemented your modifications, mainly addressing common issues in realTime and DragonBone. Please merge my changes, and set the target version for the merge to 3.8.4, as we have frozen 3.8.3. https://github.com/xinyangtan/cocos-engine/pull/1

bofeng-song avatar Apr 25 '24 09:04 bofeng-song