No, I donāt override the onExit method in any classes.
It looks like bug in cocos2d-x v3. I created a simple application, copied and pasted HelloWorldScene, renamed the class from HelloWorld to Temp and wrote
void HelloWorld::menuCloseCallback(Ref* pSender)
{
auto scene = Temp::createScene();
Director::getInstance()->replaceScene(TransitionFade::create(1, scene));
}
App crashes when I close it while transition is running.
Ready for GLSL
Ready for OpenGL 2.0
{
gl.version: 4.2.0 - Build 10.18.10.3355
gl.supports_NPOT: true
cocos2d.x.version: cocos2d-x 3.2
cocos2d.x.compiled_with_profiler: false
cocos2d.x.build_type: DEBUG
cocos2d.x.compiled_with_gl_state_cache: true
gl.max_texture_size: 16384
gl.vendor: Intel
gl.renderer: Intel(R) HD Graphics 4600
gl.max_texture_units: 96
gl.supports_ETC1: false
gl.supports_S3TC: true
gl.supports_ATITC: false
gl.supports_PVRTC: false
gl.supports_BGRA8888: false
gl.supports_discard_framebuffer: false
gl.supports_vertex_array_object: true
}
Assert failed: Node still marked as running on node destruction! Was base class onExit() called in derived class onExit() implementations?
Assertion failed!
Program: ...s2dx\projects\Temp\proj.win32\Debug.win32\Temp.exe
File: CCNode.cpp
Line: 189
Expression: !_running
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts
I use cocos2d-x v3.2 on Windows 8.1 Proffesional with MS Visual Studio 2013.
I have recorded video with crash application. (Sorry for *.wmv in *.zip - I donāt know the best way to attach the video). cocos2d-x v3 bug.zip (493.4 KB)
On the video I run the app => press button => start replace scene with Transition => close the app => see the crash.
I made a class that inherits from TableViewCell. I added my custom cell to a table which is in a scene. When I call replaceScene I get same error. It only happens on iOS 7.1. It doesnāt happen on iOS 8 either on android devices.
Just called a āreplaceSceneā, and it said āNode still marked as running on node destruction! Was base class onExit() called in derived class onExit() implementations?ā
Same thing on Win32 (v3.4). Run cpp-test go to transition menu, click on next transition and try closing application while transitioning scene (ALT+F4 or clicking on āxā) => crash.
I got this now. I am moving a game made in cocos2d-x 3.5 to 3.6ā¦ and just like that the problem appeared. I have seen this before, afair, but it was never a problem. Iām not sure what changed, except 3.5->3.6.
I do not override onExit in any class. I do override onExitTransitionDidStart, but I always and double-checked that super class implementation is called. And, this problem did not appear like this on 3.5ā¦
I would like to know if thereās a way to know WHAT node was not properly removedā¦ this is not in the debug log.
Right now Iām using RapidGame so I canāt easily dig into cocos2d-x code
Iām getting this problem with any Director::getInstance()->replaceScene(scene) call.
I seem to have find a cure for my problems. As I use RapidGame, I looked to the template game project of RapidGame to see how transitions are performed there. Turns out the structure of scenes are quite different from what Iāve been used until now in cocos2d-x.
Instead of subclassing Layer for a scene, the template subclasses Scene. No use of init(), createScene() etc. Just use new Mysceneclass when instantiating a scene. I donāt know where this kind of code came from because it does not look like itās made its way into the sample HelloCpp in cocos2d-x 3.6 yet. Things are a bit confusingā¦ but it looks like I fixed this issue for now.
Ok Iām back with thisā¦ because using new Myscene seems to likely cause memory leaks, because the scenes replaced when using replaceScene() arenāt ever deleted, obviously, because in C++ that would be the responsibility of the caller of newā¦ or so my thinking goes. So I am reverting the code to use createScene, but that brings back the crashing when going to next scene. Dohā¦