[Director FIX]: Clean all scheduler and remove all eventlisteners after exiting scene

This commit is contained in:
James Chen 2015-04-18 15:06:09 +08:00
parent 425b2b62e1
commit 6864a4a7bb
1 changed files with 10 additions and 10 deletions

View File

@ -937,16 +937,7 @@ void Director::restart()
} }
void Director::reset() void Director::reset()
{ {
// cleanup scheduler
getScheduler()->unscheduleAll();
// Remove all events
if (_eventDispatcher)
{
_eventDispatcher->removeAllEventListeners();
}
if (_runningScene) if (_runningScene)
{ {
_runningScene->onExit(); _runningScene->onExit();
@ -956,6 +947,15 @@ void Director::reset()
_runningScene = nullptr; _runningScene = nullptr;
_nextScene = nullptr; _nextScene = nullptr;
// cleanup scheduler
getScheduler()->unscheduleAll();
// Remove all events
if (_eventDispatcher)
{
_eventDispatcher->removeAllEventListeners();
}
// remove all objects, but don't release it. // remove all objects, but don't release it.
// runWithScene might be executed after 'end'. // runWithScene might be executed after 'end'.