带字符串的CCLabelTTF :: setString包含完整形状标点符号导致Android中的CCImage ::〜CCImage()崩溃

时间:2013-10-23 03:57:53

标签: android cocos2d-x

要重复此崩溃,首先我们需要一个字符串,例如

"blabla...bla "
             ^
             here is a full shape blank space. Other full shape punctuation also cause this crash, such as `!`, `・`.

其次,我们需要CCLabelTTF和

setDimensions(const CCSize &dim)
setString(const char *string) // use the string above

然后,当且仅当唯一的完整形状空白区域恰好显示在另一个新行中时,它才会崩溃。

崩溃日志如下:

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
Stack frame #00  pc 0000f41c  /system/lib/libc.so
Stack frame #01  pc 000121c3  /system/lib/libc.so (dlfree+1458)
Stack frame #02  pc 0000d333  /system/lib/libc.so (free+10)
Stack frame #03  pc 006ecc60  /data/app-lib/jp.co.gu3.allen-1/liballen.so (cocos2d::CCImage::~CCImage()+128): Routine ~CCImage in /Users/tangyue/project/crosskaiser-native-android/application/proj.android/../../cocos2dx/platform/CCImageCommon_cpp.h:91
Stack frame #04  pc 006eccc8  /data/app-lib/jp.co.gu3.allen-1/liballen.so (cocos2d::CCImage::~CCImage()+20): Routine ~CCImage in /Users/tangyue/project/crosskaiser-native-android/application/proj.android/../../cocos2dx/platform/CCImageCommon_cpp.h:92
Stack frame #05  pc 00684234  /data/app-lib/jp.co.gu3.allen-1/liballen.so (cocos2d::CCObject::release()+204): Routine release in /Users/tangyue/project/crosskaiser-native-android/application/proj.android/../../cocos2dx/cocoa/CCObject.cpp:86
Stack frame #06  pc 007230a8  /data/app-lib/jp.co.gu3.allen-1/liballen.so (cocos2d::CCTexture2D::initWithString(char const*, char const*, float, cocos2d::CCSize const&, cocos2d::CCTextAlignment, cocos2d::CCVerticalTextAlignment)+624): Routine initWithString in (null):0
Stack frame #07  pc 006b0488  /data/app-lib/jp.co.gu3.allen-1/liballen.so (cocos2d::CCLabelTTF::updateTexture()+308): Routine updateTexture in /Users/tangyue/project/crosskaiser-native-android/application/proj.android/../../cocos2dx/label_nodes/CCLabelTTF.cpp:275
Stack frame #08  pc 006afeb8  /data/app-lib/jp.co.gu3.allen-1/liballen.so (cocos2d::CCLabelTTF::setString(char const*)+204): Routine setString in /Users/tangyue/project/crosskaiser-native-android/application/proj.android/../../cocos2dx/label_nodes/CCLabelTTF.cpp:144

CCImageCommon_cpp.h:91中,它是:

CCImage::~CCImage()
{
    CC_SAFE_DELETE_ARRAY(m_pData);
}

所以,如果有人可以帮助我或提出一些建议,我将不胜感激。

该设备是三星Galaxy S4 SC-04E。

cocos2d-x版本是cocos2d-2.1rc0-x-2.1.3

2 个答案:

答案 0 :(得分:0)

我在使用CCLabelTTF时遇到了同样的问题,我发现如果你设置了Dimensions,请确保最后一行的结尾不能是\ n。

我找不到原因,我改变了字体大小并且崩溃了。

答案 1 :(得分:0)

我找到了问题的确切位置。

请参阅此commit in cocos2d-x projectthese issues

简单的代码导致了我花费大量时间的大问题:(

帮助这可以帮助像我这样穷的其他人。