一个Armature如果在同一场景下播放,并且播放完后调用removeFromParent() 释放,反复几次后, 会导致崩溃~~
还有个BUG :Armature动画的帧事件, 在反复播放以后,会出现调用时间不对 BUG
一个Armature如果在同一场景下播放,并且播放完后调用removeFromParent() 释放,反复几次后, 会导致崩溃~~
还有个BUG :Armature动画的帧事件, 在反复播放以后,会出现调用时间不对 BUG
反复removeFromParent()???这个应该只能删一次吧?
if (m_pCurArm)
{
m_pCurArm->removeFromParentAndCleanup(true);
m_pCurArm = nullptr;
}
m_pCurArm = cocostudio::Armature::create("TestAction");
各种内存发现貌似是 Scheduler 里面依旧保存着已经释放掉了的Armature的野指针,
我在 Armature 构造函数里加入 log(“new %x – %d”, this, timeGetTime()); 打印内存地址 然后在Armature的析构函数中加入log(“del %x – %d”, this, timeGetTime());
在必崩溃地方Armature::update(float dt) 加入 log(“up %x – %d”, this, timeGetTime());
发生崩溃时输出显示:
new 5fcb9f0 – 36071499
up 5fcb9f0 – 36071510
up 5fcb9f0 – 36071512
up 5fcb9f0 – 36071516
up 5fcb9f0 – 36071533
up 5fcb9f0 – 36071549
up 5fcb9f0 – 36071566
up 5fcb9f0 – 36071583
up 5fcb9f0 – 36071603
up 5fcb9f0 – 36071619
up 5fcb9f0 – 36071636
up 5fcb9f0 – 36071657
up 5fcb9f0 – 36071674
up 5fcb9f0 – 36071691
up 5fcb9f0 – 36071708
up 5fcb9f0 – 36071725
up 5fcb9f0 – 36071742
up 5fcb9f0 – 36071763
up 5fcb9f0 – 36071780
up 5fcb9f0 – 36071797
up 5fcb9f0 – 36071813
up 5fcb9f0 – 36071831
up 5fcb9f0 – 36071847
up 5fcb9f0 – 36071865
up 5fcb9f0 – 36071882
up 5fcb9f0 – 36071903
up 5fcb9f0 – 36071920
up 5fcb9f0 – 36071937
up 5fcb9f0 – 36071953
up 5fcb9f0 – 36071972
up 5fcb9f0 – 36071992
up 5fcb9f0 – 36072025
up 5fcb9f0 – 36072042
up 5fcb9f0 – 36072059
up 5fcb9f0 – 36072075
up 5fcb9f0 – 36072092
up 5fcb9f0 – 36072109
up 5fcb9f0 – 36072125
up 5fcb9f0 – 36072142
up 5fcb9f0 – 36072159
up 5fcb9f0 – 36072177
up 5fcb9f0 – 36072196
up 5fcb9f0 – 36072213
up 5fcb9f0 – 36072230
up 5fcb9f0 – 36072246
up 5fcb9f0 – 36072263
up 5fcb9f0 – 36072280
up 5fcb9f0 – 36072296
up 5fcb9f0 – 36072313
up 5fcb9f0 – 36072330
up 5fcb9f0 – 36072346
up 5fcb9f0 – 36072367
up 5fcb9f0 – 36072384
up 5fcb9f0 – 36072401
up 5fcb9f0 – 36072418
up 5fcb9f0 – 36072435
up 5fcb9f0 – 36072451
up 5fcb9f0 – 36072470
up 5fcb9f0 – 36072490
up 5fcb9f0 – 36072506
up 5fcb9f0 – 36072523
up 5fcb9f0 – 36072542
up 5fcb9f0 – 36072558
up 5fcb9f0 – 36072575
up 5fcb9f0 – 36072592
del 5fcb9f0 – 36072623
new 5ef0080 – 36072625
up 5ef0080 – 36072630
Debug Assertion Failed!
崩溃点:
void Armature::update(float dt) <----- 此时 this是 5fcb9f0 , 但是按照上面的调试信息 5fcb9f0 的Armature已经被释放掉了
{
log(“up %x – %d”, this, timeGetTime());
CC_ASSERT(_animation);
_animation->update(dt);
for(const auto &bone : _topBoneList) { bone->update(dt);
}
_armatureTransformDirty = false;
}
遇到同样的问题。
我是每次释放必然崩溃…
以下是我尝试过的几种释放方法:
崩溃
pMonster->getAnimation()->setFrameEventCallFunc(NULL,NULL);
pMonster->getAnimation()->stop();
pMonster->removeFromParentAndCleanup(true);
cocostudio::ArmatureDataManager::getInstance()->removeArmatureFileInfo(“tauren/tauren.ExportJson”);
崩溃
pMonster->removeFromParentAndCleanup(true);
崩溃
pMonster->removeFromParent();




没办法了 只有一只留着这个Armature动画, 只有等到场景切换自动释放了~~~ 坑爹啊~~
那要怎么释放呢 我也遇到这个问题