I'm facing with a lot of crash when try to addChild, removeChild inside hardware interrupts, or JAVA callback.
My game has a soft button to call to java, in order to use voice recognition.
The context:
C++: btnRecord pressed -> JAVA: startVoiceRecognition -> C++: return;
JAVA: hasResult -> C++: resultHandler -> C++: addchild, removechild, etc.-> crashed randomly.
I figured out it is crashed because of I tried to change the game data when cocos is doing the samething, in the same area.
Ex: when cocos is rendering layerA, JAVA also tried to remove layerA -> crashed.
Does cocos have any solution for this context ?
May be a callback queue which will be processed in the next game loop ?
I think the need to change the Drawing scene when you press some hard button: back key, volume key, or any hardware interrupt event is very necessary.