iossprite-kitshaderskeffectnode

SKEffectNode walk through children crashed (iOS10 Spritekit)


I have a SKEffectNode that contains a node that will change it's children dynamically through times (Remove children and add children dynamically very often). And I keep getting this crash log (only happens on iOS10) on Fabric however i cannot reproduce it on my own devices. The log seems likes it is trying to calculate the bounds of this node and get some errors. Does anyone has the same situation? plz give me sound suggestions and advices. Thanks!

0  SpriteKit                      0x190fc2810 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 100
1  SpriteKit                      0x190fc2b50 SKCNode::getAccumulatedBoundingBox() + 176
2  SpriteKit                      0x190fc3114 ___ZN7SKCNode25getAccumulatedBoundingBoxEv_block_invoke + 36
3  SpriteKit                      0x190fc2858 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 172
4  SpriteKit                      0x190fc2b50 SKCNode::getAccumulatedBoundingBox() + 176
5  SpriteKit                      0x190fc3114 ___ZN7SKCNode25getAccumulatedBoundingBoxEv_block_invoke + 36
6  SpriteKit                      0x190fc2858 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 172
7  SpriteKit                      0x190fc2b50 SKCNode::getAccumulatedBoundingBox() + 176
8  SpriteKit                      0x190fc3114 ___ZN7SKCNode25getAccumulatedBoundingBoxEv_block_invoke + 36
9  SpriteKit                      0x190fc2858 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 172
10 SpriteKit                      0x190fc2b50 SKCNode::getAccumulatedBoundingBox() + 176
11 SpriteKit                      0x19102a090 ___ZN13SKCEffectNode19ensure_framebuffersEP13SKCRenderInfoDv4_j_block_invoke + 36
12 SpriteKit                      0x190fc2858 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 172
13 SpriteKit                      0x191029ca0 SKCEffectNode::ensure_framebuffers(SKCRenderInfo*, unsigned int vector[4]) + 268
14 SpriteKit                      0x19102a1d0 SKCEffectNode::addRequistePasses(SKCRenderInfo*, std::__1::list<std::__1::shared_ptr<SKCRenderPass>, std::__1::allocator<std::__1::shared_ptr<SKCRenderPass> > >*) + 248
15 SpriteKit                      0x19106485c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 376
16 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
17 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
18 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
19 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
20 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
21 SpriteKit                      0x191063e30 SKCRenderer::buildRenderGroup(std::__1::shared_ptr<SKCRenderSortGroup> const&) + 792
22 SpriteKit                      0x191061228 SKCRenderer::buildRenderPass(std::__1::shared_ptr<SKCRenderPass> const&) + 92
23 SpriteKit                      0x191060c94 SKCRenderer::render(SKCNode*, float vector[4], std::__1::shared_ptr<jet_framebuffer> const&, unsigned int vector[4], matrix_float4x4, bool, NSDictionary*, SKCStats*, SKCStats*, double) + 1600
24 SpriteKit                      0x190ff000c __51-[SKView _vsyncRenderForTime:preRender:postRender:]_block_invoke + 1564
25 SpriteKit                      0x190ff04a0 __51-[SKView _vsyncRenderForTime:preRender:postRender:]_block_invoke.336 + 408
26 SpriteKit                      0x190fef924 -[SKView _vsyncRenderForTime:preRender:postRender:] + 572
27 SpriteKit                      0x190ff154c __29-[SKView setUpRenderCallback]_block_invoke + 208
28 SpriteKit                      0x191027144 -[SKDisplayLink _callbackForNextFrame:] + 168
29 QuartzCore                     0x184fe6f24 CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 44
30 QuartzCore                     0x184fe6dd0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 444
31 IOKit                          0x181ffe094 IODispatchCalloutFromCFMessage + 372
32 CoreFoundation                 0x181d26e50 __CFMachPortPerform + 180
33 CoreFoundation                 0x181d3f218 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
34 CoreFoundation                 0x181d3e9cc __CFRunLoopDoSource1 + 436
35 CoreFoundation                 0x181d3c4b0 __CFRunLoopRun + 1840
36 CoreFoundation                 0x181c6a2b8 CFRunLoopRunSpecific + 444
37 GraphicsServices               0x18371e198 GSEventRunModal + 180
38 UIKit                          0x187cb17fc -[UIApplication _run] + 684
39 UIKit                          0x187cac534 UIApplicationMain + 208
40 Space Walk                     0x10023fb50 main (main.m:16)
41 libdispatch.dylib              0x180c4d5b8 (Missing)

Solution

  • I finally figure out what's happening. According to Apple's documentation, we can only add and remove nodes in main thread.