about CCDirector::end() and purgeDirector

hi,
i have problem with the function CCDirector::end()
when i finished my app by pressing the home button, the current running scene’s onExit() not called
so i check the CCDirector::end() function, found it only set the m_bPurgeDirecotorInNextLoop to true,

i donot know why,

if i directly call the purgeDirector() in the end(), everything is ok.

:slight_smile:

Here’s a little different from cocos2d-iphone. After CCDirector::end() finishes its flow, the resources aren’t released yet. It just raise the flag, and purge & release job will be done in the next message loop. Doing this to avoid bug #306. So don’t worry about this.

You can read the source, purgeDirector() will be invoked in the next message loop in void CCDisplayLinkDirector::mainLoop(void) if m_bPurgeDirectorInNextloop == true.

thank you very much

:slight_smile: