mirror of https://github.com/axmolengine/axmol.git
Merge pull request #11489 from dumganhar/clean-order
[Director FIX]: Clean all schedulers and remove all eventlisteners after exiting scene
This commit is contained in:
commit
bb4e749a93
|
@ -938,15 +938,6 @@ 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();
|
||||||
|
@ -957,6 +948,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'.
|
||||||
_scenesStack.clear();
|
_scenesStack.clear();
|
||||||
|
|
Loading…
Reference in New Issue