cocos2dx 3.1 不确定这是bug还是我用法不对

Label *label = Label::createWithTTF(“Test Text”,
“MarkerFelt.ttf”,
30);
label->setPosition(100, 100);
this->addChild(label);

label->getLetter(6);

label->setString("abc");

上边的测试代码,getLetter只要取一个比即将设置的string长的数,在win32和ios都会在 TextureAtlas 中报 CCASSERT( index>=0 && index<_totalQuads, “removeQuadAtIndex: Invalid index”);

目前我是改了3.1中
CCLabel.cpp 589行
for (const auto& batchNode:_batchNodes)
{
+ Node::removeAllChildren();
batchNode->getTextureAtlas()->removeAllQuads();
}
_fontAtlas->prepareLetterDefinitions(_currentUTF16String);

CCTextureAtlas.cpp 449行
void TextureAtlas::removeAllQuads()
{

  • _totalQuads = 0;
  • removeQuadsAtIndex(0, _totalQuads);
    }

暂时解决了crash。
希望大家看看,是不是个bug,还是我用的哪里错了

下标越界 肯定不是bug

这是Bug,我晚些时候会发一个修复的PR到cocos2d-x的github仓库

https://github.com/cocos2d/cocos2d-x/pull/11659