CCEditBox crash on Android tablet

Hi, I have recently started developing Android apps, coming from coco2d-iphone. I have an app that use the CCEditBox extension, works fine on a Samsun Galaxy Mini and Ace both with OS 2.3, also works on both a Nexus 7 (4.2.2) and AndroidVM (4.0.4). All works fine. But then I tried on a UNUSUAL Vortex Pocket tablet with 4.0.4, and the app crashes. I recreated the issue with the Hello World blank template just adding the following code on the init method:

CCSize editBoxSize = CCSizeMake(538, 85);
CCEditBox*  editBox = CCEditBox::create(editBoxSize, CCScale9Sprite::create("text_bg.png"));
editBox->setFont("Arial", 25);
editBox->setPosition(ccp(size.width/2, size.height/2 + 70));
editBox->setPlaceHolder("TEXT HERE");
editBox->setFontColor(ccBLACK);
this->addChild(m_Warrant);

I have the text_bg.png adde to the project, that is not the problem, and again this works on all other devices.

The debug trace is here, doesn’t say anything to me really, but in case it help. Any help appreciated.

06-21 15:20:35.999: A/libc(1240): Fatal signal 11 (SIGSEGV) at 0x00000010 (code=1)
06-21 15:20:36.499: I/DEBUG(79): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-21 15:20:36.499: I/DEBUG(79): Build fingerprint: 'NVSBL/nuclear_evb/nuclear-evb:4.0.4/IMM76D/20130116:user/test-keys'
06-21 15:20:36.499: I/DEBUG(79): pid: 1240, tid: 1253  >>> com.twentyfoursquare.metfed <<<
06-21 15:20:36.499: I/DEBUG(79): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000010
06-21 15:20:36.499: I/DEBUG(79):  r0 4b359980  r1 00000010  r2 00000010  r3 00000000
06-21 15:20:36.499: I/DEBUG(79):  r4 00000010  r5 4b359980  r6 00000050  r7 00000002
06-21 15:20:36.499: I/DEBUG(79):  r8 4a2247b8  r9 00000002  10 4a2248f8  fp 4a224980
06-21 15:20:36.499: I/DEBUG(79):  ip 4a6a869c  sp 4a224758  lr 4a699838  pc 400f0bb4  cpsr 80000010
06-21 15:20:36.499: I/DEBUG(79):  d0  0000000000000000  d1  0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d2  0000000000000000  d3  00000000ff0000ff
06-21 15:20:36.499: I/DEBUG(79):  d4  0000000000000000  d5  0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d6  00000000ff000000  d7  0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d8  0000000000000000  d9  0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d10 0000000000000000  d11 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d12 0000000000000000  d13 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d14 0000000000000000  d15 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d16 6000000000010002  d17 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d18 0000000000000000  d19 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d20 0000000000000000  d21 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d22 0000000000000000  d23 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d24 ffffffffffffffff  d25 b4b4b4b462626262
06-21 15:20:36.499: I/DEBUG(79):  d26 65656565e8e8e8e8  d27 0808080800000000
06-21 15:20:36.499: I/DEBUG(79):  d28 0000000000000000  d29 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  d30 0000000000000000  d31 0000000000000000
06-21 15:20:36.499: I/DEBUG(79):  scr 60000012
06-21 15:20:36.609: I/DEBUG(79):          #00  pc 0000dbb4  /system/lib/libc.so (memcpy)
06-21 15:20:36.609: I/DEBUG(79):          #01  pc 00021834  /system/lib/egl/libGLESv2_mali.so
06-21 15:20:36.609: I/DEBUG(79):          #02  pc 00021b10  /system/lib/egl/libGLESv2_mali.so (_gles_gb_setup_input_streams)
06-21 15:20:36.609: I/DEBUG(79):          #03  pc 0002141c  /system/lib/egl/libGLESv2_mali.so (_gles_gb_vs_setup)
06-21 15:20:36.609: I/DEBUG(79):          #04  pc 00023764  /system/lib/egl/libGLESv2_mali.so (_gles_gb_draw_nonindexed)
06-21 15:20:36.609: I/DEBUG(79):          #05  pc 00026c88  /system/lib/egl/libGLESv2_mali.so (_gles2_draw_arrays)
06-21 15:20:36.619: I/DEBUG(79):          #06  pc 0000be24  /system/lib/egl/libGLESv2_mali.so (glDrawArrays)
06-21 15:20:36.619: I/DEBUG(79):          #07  pc 00304f9c  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d8CCSprite4drawEv)
06-21 15:20:36.619: I/DEBUG(79):          #08  pc 0027bf2c  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv)
06-21 15:20:36.619: I/DEBUG(79):          #09  pc 0027bee0  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv)
06-21 15:20:36.619: I/DEBUG(79):          #10  pc 001dcde4  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d9extension9CCEditBox5visitEv)
06-21 15:20:36.619: I/DEBUG(79):          #11  pc 0027bee0  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv)
06-21 15:20:36.619: I/DEBUG(79):          #12  pc 0027bee0  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv)
06-21 15:20:36.619: I/DEBUG(79):          #13  pc 0027bee0  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv)
06-21 15:20:36.619: I/DEBUG(79):          #14  pc 002be360  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d17CCTransitionScene4drawEv)
06-21 15:20:36.619: I/DEBUG(79):          #15  pc 0027be9c  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv)
06-21 15:20:36.619: I/DEBUG(79):          #16  pc 00290c18  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d10CCDirector9drawSceneEv)
06-21 15:20:36.619: I/DEBUG(79):          #17  pc 00293818  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (_ZN7cocos2d21CCDisplayLinkDirector8mainLoopEv)
06-21 15:20:36.619: I/DEBUG(79):          #18  pc 002f95a8  /data/data/com.twentyfoursquare.metfed/lib/libgame.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender)
06-21 15:20:36.619: I/DEBUG(79):          #19  pc 0001ec30  /system/lib/libdvm.so (dvmPlatformInvoke)
06-21 15:20:36.619: I/DEBUG(79):          #20  pc 00058c70  /system/lib/libdvm.so (_Z16dvmCallJNIMethodPKjP6JValuePK6MethodP6Thread)
06-21 15:20:36.619: I/DEBUG(79): code around pc:
06-21 15:20:36.619: I/DEBUG(79): 400f0b94 f5d1f000 f5d1f040 e2522040 3a000013  ....@...@ R....:
06-21 15:20:36.619: I/DEBUG(79): 400f0ba4 f5d0f100 f5d1f100 e3520801 8a000008  ..........R.....
06-21 15:20:36.629: I/DEBUG(79): 400f0bb4 f421020d f421420d f5d0f100 f5d1f100  ..!..B!.........
06-21 15:20:36.629: I/DEBUG(79): 400f0bc4 e2522040 f400022d f400422d 2afffff7  @ R.-...-B.....*
06-21 15:20:36.629: I/DEBUG(79): 400f0bd4 eb000006 f421020d f421420d f5d1f100  ......!..B!.....
06-21 15:20:36.629: I/DEBUG(79): code around lr:
06-21 15:20:36.629: I/DEBUG(79): 4a699818 e1a02003 e1a06001 ebffa407 e2505000  . ...`.......PP.
06-21 15:20:36.629: I/DEBUG(79): 4a699828 0a000002 e1a01004 e1a02006 ebffa399  ......... ......
06-21 15:20:36.629: I/DEBUG(79): 4a699838 e1a00005 e8bd8070 e92d4ff0 e24ddf9b  ....p....O-...M.
06-21 15:20:36.629: I/DEBUG(79): 4a699848 e59f47b0 e3a03000 e58d0030 e28daf62  .G...0..0...b...
06-21 15:20:36.629: I/DEBUG(79): 4a699858 e58d102c e08f0004 e59d1030 e3e02000  ,.......0.... ..
06-21 15:20:36.629: I/DEBUG(79): stack:
06-21 15:20:36.629: I/DEBUG(79):     4a224718  4a224940  
06-21 15:20:36.629: I/DEBUG(79):     4a22471c  00000018  
06-21 15:20:36.629: I/DEBUG(79):     4a224720  00001406  
06-21 15:20:36.629: I/DEBUG(79):     4a224724  4b359500  /dev/mali
06-21 15:20:36.629: I/DEBUG(79):     4a224728  00b740e8  [heap]
06-21 15:20:36.629: I/DEBUG(79):     4a22472c  4a224958  
06-21 15:20:36.629: I/DEBUG(79):     4a224730  4a6a8594  /system/lib/egl/libGLESv2_mali.so
06-21 15:20:36.629: I/DEBUG(79):     4a224734  ffffffec  
06-21 15:20:36.629: I/DEBUG(79):     4a224738  4a22495c  
06-21 15:20:36.629: I/DEBUG(79):     4a22473c  00000023  
06-21 15:20:36.629: I/DEBUG(79):     4a224740  00bb3d50  [heap]
06-21 15:20:36.629: I/DEBUG(79):     4a224744  00000001  
06-21 15:20:36.629: I/DEBUG(79):     4a224748  4b358c00  /dev/mali
06-21 15:20:36.629: I/DEBUG(79):     4a22474c  4a699838  /system/lib/egl/libGLESv2_mali.so
06-21 15:20:36.629: I/DEBUG(79):     4a224750  df0027ad  
06-21 15:20:36.629: I/DEBUG(79):     4a224754  00000000  
06-21 15:20:36.629: I/DEBUG(79): #00 4a224758  4b359980  /dev/mali
06-21 15:20:36.629: I/DEBUG(79):     4a22475c  4a699838  /system/lib/egl/libGLESv2_mali.so
06-21 15:20:36.629: I/DEBUG(79): #01 4a224760  4a2247d0  
06-21 15:20:36.629: I/DEBUG(79):     4a224764  00000002  
06-21 15:20:36.629: I/DEBUG(79):     4a224768  00ae5878  [heap]
06-21 15:20:36.629: I/DEBUG(79):     4a22476c  4a699b14  /system/lib/egl/libGLESv2_mali.so

I have the same bug.

I have been testing in five Android phones.

This same bug appears only one of them. (Galaxy S 2 - Android version 4.0.3)

I am not sure it’s related with the Android OS version, maybe the devices input method? I have tested in about 30 real devices and only failed on a Samsung Galaxy Note OS 2.3.6 and on a UNUSUAL Vortex Pocket tablet with 4.0.4, so can’t be the OS version. Also can’t be my code since it works in 28 devices out of 30, and I managed to reproduce on a hello world blank template. I understand the input methods on Android are such a pain, so hope you guys can find a solution. Will post if I can find something myself.

I have the same bug Galaxy S2 - 4.0.4
But on Galaxy S2(2.3.3) runs successfully.

Engine version?

I’m using cocos2d-x 2.1rc0-x-2.1.4

I’m getting a crash on a Kindle Fire HD too, other devices seem ok. It doesn’t happen every time as well, it’s seems to be while waiting for the keyboard to pop up after text box has been tapped. No idea if this helps or not but heres a trace (this is version cocos2d-2.1beta3-x-2.1.1):

06-30 20:50:12.164: W/GraphicBufferMapper(19968): registerBuffer(0x16ff068) failed -14 (Bad address)
06-30 20:50:12.164: W/GraphicBufferMapper(19968): lock(...) failed -22 (Invalid argument)
06-30 20:50:12.164: W/SurfaceTextureClient(19968): failed locking buffer (handle = 0x16ff068)
06-30 20:50:12.164: A/libc(19968): Fatal signal 11 (SIGSEGV) at 0x3409fef5 (code=1)

Hey guys,
CCEditBox for Android is putting a system control named EditText covering on a normal View. I don’t know why its behavior is different on different android version and different android devices.
I will be happy to help you guys to resolve the problems, but the pity is that I don’t get a device like UNUSUAL Vortex Pocket tablet or Galaxy S2 - 4.0.4.

Good news, I found a S2 in my company. I’m testing it. :slight_smile: Will let you know the result.

Updated.
I couldn’t reproduce it on GT-I9100 android 4.0.4. Any ideas?

Try to use another input method and see whether it happens.

Thanks James, yes the crash seems a bit random, I can’t really tie up to any particular device or OS version, I thought about the input methods, so I tried different ones, and didn’t help, I even disabled the google voice just in case, nope, installed another keyboard (SwiftKey Keyboard I think it was), and same result. Anyway if I can be of any help, I have a device that fails (the UNUSUAL tablet).

Some more trace in case it helps:

7-01 11:27:45.919 I/BootReceiver(  148): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
07-01 11:27:45.939 W/InputDispatcher(  148): channel '414b41e0 com.twentyfoursquare.metfed/com.twentyfoursquare.metfed.Metfed (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
07-01 11:27:45.939 E/InputDispatcher(  148): channel '414b41e0 com.twentyfoursquare.metfed/com.twentyfoursquare.metfed.Metfed (server)' ~ Channel is unrecoverably broken and will be disposed!
07-01 11:27:45.949 D/Zygote  (  123): Process 1167 terminated by signal (11)
07-01 11:27:45.999 D/dalvikvm(  148): GC_FOR_ALLOC freed 279K, 12% free 10183K/11527K, paused 71ms
07-01 11:27:45.999 W/InputDispatcher(  148): Attempted to unregister already unregistered input channel '414b41e0 com.twentyfoursquare.metfed/com.twentyfoursquare.metfed.Metfed (server)'
07-01 11:27:45.999 I/WindowManager(  148): WIN DEATH: Window{414b41e0 com.twentyfoursquare.metfed/com.twentyfoursquare.metfed.Metfed paused=false}
07-01 11:27:45.999 W/WindowManager(  148): Force-removing child win Window{412eaf70 SurfaceView paused=false} from container Window{414b41e0 com.twentyfoursquare.metfed/com.twentyfoursquare.metfed.Metfed paused=false}
07-01 11:27:45.999 I/ActivityManager(  148): Process com.twentyfoursquare.metfed (pid 1167) has died.

I have the same bug on Samsung note2 (4.0.3):(,other android phone is ok.
I’m using cocos2d-x 2.1rc0-x-2.1.4

I have the same bug too. There is a sprite, a control button and an edit box in my scene. If i remove the control button and the edit box, only draw the sprite, it not crash.

INFO
D/dalvikvm(25626): Trying to load lib /data/data/com.love.star/lib/libgame.so 0x415037f0 D/dalvikvm(25626): Added shared lib /data/data/com.love.star/lib/libgame.so 0x415037f0 D/Cocos2dxActivity(25626): model=GT-I9100 D/Cocos2dxActivity(25626): product=GT-I9100 D/Cocos2dxActivity(25626): isEmulator=false D/SensorManager(25626): ====>>>>>Num Sensor: 1 D/SensorManager(25626): ====>>>>>Num Sensor: 2 D/SensorManager(25626): ====>>>>>Num Sensor: 3 D/SensorManager(25626): ====>>>>>Num Sensor: 4 D/SensorManager(25626): ====>>>>>Num Sensor: 5 D/SensorManager(25626): ====>>>>>Num Sensor: 6 D/SensorManager(25626): ====>>>>>Num Sensor: 7 D/SensorManager(25626): ====>>>>>Num Sensor: 8 D/SensorManager(25626): ====>>>>>Num Sensor: 9 D/SensorManager(25626): ====>>>>>Num Sensor: 10 D/SensorManager(25626): ====>>>>>Num Sensor: 0 V/PhoneStatusBar( 2117): setLightsOn(true) D/Sensors ( 2441): Remain listener = Sending .. normal delay 200ms I/Sensors ( 2441): sendDelay --- 200000000 D/SensorManager( 2441): JNI - sendDelay I/SensorManager( 2441): Set normal delay = true D/SensorManager( 2441): unregisterListener:: handle = 0 Listener= cxd417b7e50 name = K3DH Acceleration Sensor
D/dalvikvm( 1991): GC_EXPLICIT freed 6484K, 42% free 20984K/35655K, paused 3ms+6ms
W/SurfaceView( 2254): CHECK surface infomation creating=false formatChanged=false sizeChanged=false visible=false visibleChanged=true surfaceChanged=true realSizeChanged=false redrawNeeded=false left=false top=false
D/libEGL (25626): loaded /system/lib/egl/libEGL_mali.so
D/libEGL (25626): loaded /system/lib/egl/libGLESv1_CM_mali.so
D/libEGL (25626): loaded /system/lib/egl/libGLESv2_mali.so
D/ (25626): Device driver API match
D/ (25626): Device driver API version: 10
D/ (25626): User space API version: 10
D/ (25626): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Mon Mar 5 09:47:55 KST 2012
D/cocos2d-x debug info(25626):
D/cocos2d-x debug info(25626):
D/cocos2d-x debug info(25626): cocos2d.x.version: 2.1rc0-x-2.1.4
D/cocos2d-x debug info(25626): cocos2d.x.compiled_with_profiler: false
D/cocos2d-x debug info(25626): cocos2d.x.compiled_with_gl_state_cache: true
D/cocos2d-x debug info(25626): gl.vendor: ARM
D/cocos2d-x debug info(25626): gl.renderer: Mali-400 MP
D/cocos2d-x debug info(25626): gl.version: OpenGL ES 2.0
D/cocos2d-x debug info(25626): gl.max_texture_size: 4096
D/cocos2d-x debug info(25626): gl.max_texture_units: 8
D/cocos2d-x debug info(25626): gl.supports_PVRTC: false
D/cocos2d-x debug info(25626): gl.supports_NPOT: true
D/cocos2d-x debug info(25626): gl.supports_BGRA8888: false
D/cocos2d-x debug info(25626): gl.supports_discard_framebuffer: true
D/cocos2d-x debug info(25626): gl.supports_vertex_array_object: false
D/cocos2d-x debug info(25626):
D/CLIPBOARD(25626): Hide Clipboard dialog at Starting input: finished by someone else… !
D/GLSurfaceViewGroup( 2254): Skipped drawing due to suspendDrawingUntilResume()
D/CLIPBOARD( 2254): Hide Clipboard dialog at Starting input: finished by someone else… !
D/cocos2d-x debug info(25626): JS: localStorage = [object Object]
D/cocos2d-x debug info(25626): JS: capabilities = [object Object]
D/cocos2d-x debug info(25626): JS: os = android
D/cocos2d-x debug info(25626): JS: platform = mobile
D/cocos2d-x debug info(25626): JS: version = 2.1rc0-x-2.1.4 - 0.3-beta
D/cocos2d-x debug info(25626): JS: garbageCollect = function () {
D/cocos2d-x debug info(25626): [sourceless code]
D/cocos2d-x debug info(25626): }
D/cocos2d-x debug info(25626): JS: dumpRoot = function () {
D/cocos2d-x debug info(25626): [sourceless code]
D/cocos2d-x debug info(25626): }
D/cocos2d-x debug info(25626): JS: restartVM = function () {
D/cocos2d-x debug info(25626): [sourceless code]
D/cocos2d-x debug info(25626): }
D/cocos2d-x debug info(25626): JS: opengl = true
D/cocos2d-x debug info(25626): JS: accelerometer = true
D/cocos2d-x debug info(25626): JS: touches = true@

ERROR
F/libc (25626): Fatal signal 11 (SIGSEGV) at 0x00000010 (code=1) I/DEBUG (23157): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** I/DEBUG (23157): Build fingerprint: 'samsung/GT-I9100/GT-I9100:4.0.3/IML74K/ZSLPG:user/release-keys' I/DEBUG (23157): pid: 25626, tid: 25639 >>> com.love.star <<< I/DEBUG (23157): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000010 I/DEBUG (23157): r0 503e5d80 r1 00000010 r2 00000030 r3 00000000 I/DEBUG (23157): r4 00000010 r5 503e5d80 r6 00000050 r7 00000002 I/DEBUG (23157): r8 512c0840 r9 00000002 10 512c0980 fp 512c0a08 I/DEBUG (23157): ip 00000040 sp 512c07c0 lr 4ff628d0 pc 400f2bcc cpsr 20000010 I/DEBUG (23157): d0 43f0000043f00000 d1 0000000000000000 I/DEBUG (23157): d2 4448000044480000 d3 00000320c3c80000 I/DEBUG (23157): d4 000000003f000000 d5 4448000043f00000 I/DEBUG (23157): d6 4447c00043ef8000 d7 0000000000000000 I/DEBUG (23157): d8 0000000000000000 d9 0000000000000000 I/DEBUG (23157): d10 0000000000000000 d11 0000000000000000 I/DEBUG (23157): d12 0000000000000000 d13 0000000000000000 I/DEBUG (23157): d14 0000000000000000 d15 0000000000000000 I/DEBUG (23157): d16 6000000000010002 d17 0000000000000000 I/DEBUG (23157): d18 ffffffff1d1d1d1d d19 1d1d1d1dffffffff I/DEBUG (23157): d20 0000000000000000 d21 0000000000000000 I/DEBUG (23157): d22 0000000000000000 d23 0000000000000000 I/DEBUG (23157): d24 ffffffffb4b4b4b4 d25 9e9e9e9effffffff I/DEBUG (23157): d26 00000000f7f7f7f7 d27 f7f7f7f700000000 I/DEBUG (23157): d28 0000000000000000 d29 0000000000000000 I/DEBUG (23157): d30 0000000000000000 d31 0000000000000000 I/DEBUG (23157): scr 60000012 I/DEBUG (23157): E/lights ( 1991): write_int: path /sys/devices/virtual/sec/sec_touchkey/brightness, value 2 W/PowerManagerService( 1991): Timer 0x7->0x3|0x0 I/PowerManagerService( 1991): Ulight 7->3|0 D/PowerManagerService( 1991): setLightBrightness : mButtonLight : 0 V/WindowOrientationListener( 1991): nearestRotation : 0 Angle: 355 tilt: 37 I/DEBUG (23157): #00 pc 0000dbcc /system/lib/libc.so (memcpy) I/DEBUG (23157): #01 pc 000218cc /system/lib/egl/libGLESv2_mali.so (_gles_gb_allocate_and_fill_temp_memory) I/DEBUG (23157): #02 pc 00021ba8 /system/lib/egl/libGLESv2_mali.so (_gles_gb_setup_input_streams) I/DEBUG (23157): #03 pc 000214b4 /system/lib/egl/libGLESv2_mali.so (_gles_gb_vs_setup) I/DEBUG (23157): #04 pc 000237fc /system/lib/egl/libGLESv2_mali.so (_gles_gb_draw_nonindexed) I/DEBUG (23157): #05 pc 00026d20 /system/lib/egl/libGLESv2_mali.so (_gles2_draw_arrays) I/DEBUG (23157): #06 pc 0000be84 /system/lib/egl/libGLESv2_mali.so (glDrawArrays) I/DEBUG (23157): #07 pc 0070aeb8 /data/data/com.love.star/lib/libgame.so (_ZN7cocos2d8CCSprite4drawEv) I/DEBUG (23157): #08 pc 006e000a /data/data/com.love.star/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv) I/DEBUG (23157): #09 pc 006e004e /data/data/com.love.star/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv) I/DEBUG (23157): #10 pc 006e004e /data/data/com.love.star/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv) I/DEBUG (23157): #11 pc 006e004e /data/data/com.love.star/lib/libgame.so (_ZN7cocos2d6CCNode5visitEv) I/DEBUG (23157): #12 pc 006e606c /data/data/com.love.star/lib/libgame.so (_ZN7cocos2d10CCDirector9drawSceneEv) I/DEBUG (23157): #13 pc 006e60d8 /data/data/com.love.star/lib/libgame.so (_ZN7cocos2d21CCDisplayLinkDirector8mainLoopEv) I/DEBUG (23157): #14 pc 007074f6 /data/data/com.love.star/lib/libgame.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender) I/DEBUG (23157): #15 pc 0001ecf0 /system/lib/libdvm.so (dvmPlatformInvoke) I/DEBUG (23157): #16 pc 00058fac /system/lib/libdvm.so (_Z16dvmCallJNIMethodPKjP6JValuePK6MethodP6Thread) I/DEBUG (23157): I/DEBUG (23157): code around pc: I/DEBUG (23157): 400f2bac e3130004 1491a004 1480a004 e0422003 ............. B. I/DEBUG (23157): 400f2bbc e2522020 3a000008 e3c1c01f e28cc040 R....:....
I/DEBUG (23157): 400f2bcc e8b10ff0 f5dcf040 e2522020 849c3020 ….... R. 0.. I/DEBUG (23157): 400f2bdc e8a00ff0 2afffff9 e2822020 e312001f .......* ...... I/DEBUG (23157): 400f2bec 0a00000c e1b0ce02 28b100f0 48b10300 ...........(...H I/DEBUG (23157): I/DEBUG (23157): code around lr: I/DEBUG (23157): 4ff628b0 e1a02003 e1a06001 ebffa3f8 e2505000 . ...`.......PP. I/DEBUG (23157): 4ff628c0 0a000002 e1a01004 e1a02006 ebffa38a ......... ...... I/DEBUG (23157): 4ff628d0 e1a00005 e8bd8070 e92d4ff0 e24ddf9b ....p....O-...M. I/DEBUG (23157): 4ff628e0 e59f47b0 e3a03000 e58d0030 e28daf62 .G...0..0...b... I/DEBUG (23157): 4ff628f0 e58d102c e08f0004 e59d1030 e3e02000 ,.......0.... .. I/DEBUG (23157): I/DEBUG (23157): stack: I/DEBUG (23157): 512c0780 00000001 I/DEBUG (23157): 512c0784 512c09b8 I/DEBUG (23157): 512c0788 511599ac /data/data/com.love.star/lib/libgame.so I/DEBUG (23157): 512c078c 002568b8 [heap] I/DEBUG (23157): 512c0790 00000000 I/DEBUG (23157): 512c0794 5275e980 I/DEBUG (23157): 512c0798 00000002 I/DEBUG (23157): 512c079c 00000018 I/DEBUG (23157): 512c07a0 00000003 I/DEBUG (23157): 512c07a4 00000000 I/DEBUG (23157): 512c07a8 0000c002 [heap] I/DEBUG (23157): 512c07ac 4ff6f4a8 /system/lib/egl/libGLESv2_mali.so I/DEBUG (23157): 512c07b0 512c09d8 I/DEBUG (23157): 512c07b4 00000018 I/DEBUG (23157): 512c07b8 df0027ad I/DEBUG (23157): 512c07bc 00000000 I/DEBUG (23157): #00 512c07c0 503e5d80 /dev/mali I/DEBUG (23157): 512c07c4 00000050 I/DEBUG (23157): 512c07c8 00000002 I/DEBUG (23157): 512c07cc 512c0840 I/DEBUG (23157): 512c07d0 00000002 I/DEBUG (23157): 512c07d4 512c0980 I/DEBUG (23157): 512c07d8 512c0a08 I/DEBUG (23157): 512c07dc 503e5d80 /dev/mali I/DEBUG (23157): 512c07e0 00000010 I/DEBUG (23157): 512c07e4 4ff628d0 /system/lib/egl/libGLESv2_mali.so I/DEBUG (23157): #01 512c07e8 512c0858 I/DEBUG (23157): 512c07ec 00000002 I/DEBUG (23157): 512c07f0 001fa9a0 [heap] I/DEBUG (23157): 512c07f4 4ff62bac /system/lib/egl/libGLESv2_mali.so

up

it’s caused by a empty sting TTFLabel, TTFLabel::initWithString use setString to init, but empty string “” , is equal to m_string’s default value.
so, the texture is not set correctly. lead some GL drive to crash.

xuewu li wrote:

it’s caused by a empty sting TTFLabel, TTFLabel::initWithString use setString to init, but empty string “” , is equal to m_string’s default value.
so, the texture is not set correctly. lead some GL drive to crash.

Hi @xuewu,
Did you try 3.0-pre-alpha0?

In 3.0, we will create an empty texture when setTexture(NULL) is invoked.

Please refer to

/*
 * This array is the data of a white image with 2 by 2 dimension.
 * It's used for creating a default texture when sprite's texture is set to NULL.
 * Supposing codes as follows:
 *
 *   auto sp = new Sprite();
 *   sp->init();  // Texture was set to NULL, in order to make opacity and color to work correctly, we need to create a 2x2 white texture.
 *
 * The test is in "TestCpp/SpriteTest/Sprite without texture".
 */
static unsigned char cc_2x2_white_image[] = {
    // RGBA8888
    0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF
};

#define CC_2x2_WHITE_IMAGE_KEY  "cc_2x2_white_image"

void Sprite::setTexture(Texture2D *texture)
{
    // If batchnode, then texture id should be the same
    CCASSERT(! _batchNode || texture->getName() == _batchNode->getTexture()->getName(), "CCSprite: Batched sprites should use the same texture as the batchnode");
    // accept texture==nil as argument
    CCASSERT( !texture || dynamic_cast(texture), "setTexture expects a Texture2D. Invalid argument");

    if (NULL == texture)
    {
        // Gets the texture by key firstly.
        texture = TextureCache::getInstance()->textureForKey(CC_2x2_WHITE_IMAGE_KEY);

        // If texture wasn't in cache, create it from RAW data.
        if (NULL == texture)
        {
            Image* image = new Image();
            bool isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
            CCAssert(isOK, "The 2x2 empty texture was created unsuccessfully.");

            texture = TextureCache::getInstance()->addUIImage(image, CC_2x2_WHITE_IMAGE_KEY);
            CC_SAFE_RELEASE(image);
        }
    }

    if (!_batchNode && _texture != texture)
    {
        CC_SAFE_RETAIN(texture);
        CC_SAFE_RELEASE(_texture);
        _texture = texture;
        updateBlendFunc();
    }
}

3.0 is great, is finally have a c++ style ,but object-c.:slight_smile:

this issue took me half a day, it drives me crazy, so, still hope it’s will be fixed for the guys who still working on 2.x.

Any suggested patch for cocos2d-x 2.1?

Thanks for the help!