diff --git a/cocos/2d/CCMenu.cpp b/cocos/2d/CCMenu.cpp index a118b3019b..5d9a861e48 100644 --- a/cocos/2d/CCMenu.cpp +++ b/cocos/2d/CCMenu.cpp @@ -25,7 +25,6 @@ THE SOFTWARE. ****************************************************************************/ #include "2d/CCMenu.h" #include "base/CCDirector.h" -#include "CCApplication.h" #include "base/CCTouch.h" #include "CCStdC.h" #include "base/CCEventListenerTouch.h" diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index ac7519a062..fe22befbce 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -177,7 +177,6 @@ Director::~Director(void) CC_SAFE_RELEASE(_scheduler); CC_SAFE_RELEASE(_actionManager); - delete _eventAfterUpdate; delete _eventAfterDraw; delete _eventAfterVisit; @@ -191,12 +190,11 @@ Director::~Director(void) CC_SAFE_RELEASE(_eventDispatcher); - // clean auto release pool - PoolManager::destroyInstance(); - // delete _lastUpdate CC_SAFE_DELETE(_lastUpdate); + Configuration::destroyInstance(); + s_SharedDirector = nullptr; } @@ -976,7 +974,6 @@ void Director::purgeDirector() GLProgramCache::destroyInstance(); GLProgramStateCache::destroyInstance(); FileUtils::destroyInstance(); - Configuration::destroyInstance(); // cocos2d-x specific data structures UserDefault::destroyInstance(); diff --git a/cocos/platform/CCApplicationProtocol.h b/cocos/platform/CCApplicationProtocol.h index bf040c059d..501cd2f9c0 100644 --- a/cocos/platform/CCApplicationProtocol.h +++ b/cocos/platform/CCApplicationProtocol.h @@ -27,6 +27,8 @@ THE SOFTWARE. #define __CC_APPLICATION_PROTOCOL_H__ #include "base/CCPlatformMacros.h" +#include "base/CCScriptSupport.h" +#include "base/CCAutoreleasePool.h" NS_CC_BEGIN @@ -61,7 +63,11 @@ public: * @js NA * @lua NA */ - virtual ~ApplicationProtocol() {} + virtual ~ApplicationProtocol(){ + ScriptEngineManager::destroyInstance(); + // clean auto release pool + PoolManager::destroyInstance(); + } /** @brief Implement Director and Scene init code here.