Projects > cpp > Issues > Bug #2970

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

crash for CCLabelTTF when setting dimension input height value less then the height of the font and the input width is 0

Bug #2970 [Closed]
congling@hotmail.com 2013-10-12 03:18 . Updated about 3 years ago

In HelloLua project, add these lines in hello.lua

local ttfLabel = CCLabelTTF:create("hello world", "Helvetica", 48)
ttfLabel:setDimensions(CCSizeMake(0, 10))

after build to device it will crash, exception here:

/WVMExtractor(  109): Failed to open libwvm.so
E/WVMExtractor(  109): Failed to open libwvm.so
V/dalvikvm( 2430): +++ not scanning '/system/lib/libwebcore.so' for 'nativeInitBitmapDC' (wrong CL)
V/dalvikvm( 2430): +++ not scanning 'libnativehelper.so' for 'nativeInitBitmapDC' (wrong CL)
V/dalvikvm( 2430): +++ not scanning 'libjavacore.so' for 'nativeInitBitmapDC' (wrong CL)
V/dalvikvm( 2430): +++ scanning '/data/data/org.cocos2dx.hellolua/lib/libhellolua.so' for 'nativeInitBitmapDC'
V/dalvikvm( 2430): +++ calling dlsym(Java_org_cocos2dx_lib_Cocos2dxBitmap_nativeInitBitmapDC)
V/dalvikvm( 2430): Found 'Java_org_cocos2dx_lib_Cocos2dxBitmap_nativeInitBitmapDC' with dlsym
F/libc    ( 2430): @@@ ABORTING: INVALID HEAP ADDRESS IN dlfree addr=0xb7b26d70
F/libc    ( 2430): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 2442 (Thread-122)
I/DEBUG   (  104): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  104): Build fingerprint: 'generic/vbox86p/vbox86p:4.1.1/JRO03S/eng.buildbot.20130923.155608:userdebug/test-keys'
I/DEBUG   (  104): pid: 2430, tid: 2442, name: Thread-122  >>> org.cocos2dx.hellolua <<<
I/DEBUG   (  104): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
I/DEBUG   (  104):     eax 00000043  ebx b7593f4c  ecx 00000001  edx b7b26d70
I/DEBUG   (  104):     esi fffffffb  edi 00000062
I/DEBUG   (  104):     xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000043  xss 0000007b
I/DEBUG   (  104):     eip b7523cf0  ebp 99207724  esp 992075dc  flags 00010217
I/DEBUG   (  104):
I/DEBUG   (  104): backtrace:
I/DEBUG   (  104):     #00  pc 00011cf0  /system/lib/libc.so (__bionic_heap_error+320)
I/DEBUG   (  104):     #01  pc 000159e2  /system/lib/libc.so (dlfree+2114)
I/DEBUG   (  104):     #02  pc 000164f2  /system/lib/libc.so (free+34)

/data/data/org.cocos2dx.hellolua/lib/libhellolua.so (cocos2d::CCImage::~CCImage())
congling@hotmail.com 2013-10-12 03:19

The bug is related to #2966

walzer@cocos2d-x.org 2013-10-12 03:26
  • Description updated (diff)
  • Assignee set to samuele3hu
  • Target version set to 3.0-alpha1
walzer@cocos2d-x.org 2013-10-12 03:27
  • Subject changed from crash for CCTTFLabel when setting dimension width less than the font height to crash for CCLabelTTF when setting dimension width less than the font height
samuele3hu 2013-10-15 02:33

When the input height value less then the height of perLine and the input width is 0, it will lead to set the mMaxWidth of TextProperty 0 and when createBitmap,it crash.
Another Bug, if the first word width less than designed width ,operate the divideStringWithMaxWidth function will come into endless loop.

samuele3hu 2013-11-01 02:21
  • % Done changed from 0 to 100
zhangxm 2013-11-16 10:04
  • Subject changed from crash for CCLabelTTF when setting dimension width less than the font height to crash for CCLabelTTF when setting dimension input height value less then the height of the font and the input width is 0
  • Status changed from New to Closed

Atom PDF

Status:Closed
Start date:2013-10-12
Priority:Normal
Due date:
Assignee:samuele3hu
% Done:

100%

Category:android
Target version:3.0-alpha1

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.