fixed memory leak cause by singleton.

This commit is contained in:
Dhilan007 2014-07-08 18:22:48 +08:00
parent e31abe3f54
commit 10defddc2e
3 changed files with 9 additions and 7 deletions

View File

@ -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"

View File

@ -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();

View File

@ -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.