iOS crash on basic_string constructor

iOS crash on basic_string constructor
0

Hey everyone.

Does anyone have an idea what would cause this crash on some iOS devices (11+) ?

0  libc++.1.dylib                 0x199593608 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 32
1  My-Game                    0x10009996c LoadScene::onEnter() + 4125 (string:4125)

FYI code compiled using cocos2dx v 3.17.1

The source code line number is not correct in the stack trace but it should be somewhere here:

void LoadScene::onEnter()
{
    CCLOG("[node] Loadscene enter");

    Node::onEnter();
....

Thanks

Akshay

If you look at the call stack, what code of yours is starting this call chain?

Hello @slackmoehrle! Hope all is well with you in these uncertain times!

I’ve included the complete stack trace here. “LoadScene” is the first cocos2d scene that is displayed.

Thanks

Akshay

Crashed: com.apple.main-thread
0 libc++.1.dylib 0x199593608 std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::basic_string(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 32
1 Tonk-mobile 0x10009996c LoadScene::onEnter() + 4125 (string:4125)
2 Tonk-mobile 0x10054012c cocos2d::Node::onEnter() + 4383326508
3 Tonk-mobile 0x100515498 cocos2d::Director::setNextScene() + 4383151256
4 Tonk-mobile 0x1005151e0 cocos2d::Director::drawScene() + 4383150560
5 Tonk-mobile 0x1006a3678 -[CCEAGLView layoutSubviews] + 4384781944
6 UIKitCore 0x19dc3217c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2140
7 QuartzCore 0x1a019a2c0 -[CALayer layoutSublayers] + 284
8 QuartzCore 0x1a01a043c CA::Layer::layout_if_needed(CA::Transaction*) + 480
9 QuartzCore 0x1a01ab140 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
10 QuartzCore 0x1a00f3884 CA::Context::commit_transaction(CA::Transaction*, double) + 304
11 QuartzCore 0x1a011d574 CA::Transaction::commit() + 676
12 UIKitCore 0x19d7b3ac8 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 80
13 CoreFoundation 0x199694834 CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 20
14 CoreFoundation 0x199693fd4 __CFRunLoopDoBlocks + 264
15 CoreFoundation 0x19968f250 __CFRunLoopRun + 1100
16 CoreFoundation 0x19968eadc CFRunLoopRunSpecific + 464
17 GraphicsServices 0x1a362f328 GSEventRunModal + 104
18 UIKitCore 0x19d79c63c UIApplicationMain + 1936
19 Tonk-mobile 0x10011b4c4 main + 6 (main.m:6)
20 libdyld.dylib 0x199518360 start + 4

so I’d suggest setting a breakpoint and stepping line by line until it crashes and then you can see how you got there, i.e where in your code this was triggered.