Merge pull request #6151 from mgcL/ScriptHandlerMgr-memory-free

add destroyInstance for ScriptHandlerMgr
This commit is contained in:
James Chen 2014-04-08 15:41:18 +08:00
commit 28ebec46dc
2 changed files with 9 additions and 2 deletions

View File

@ -124,10 +124,11 @@ ScriptHandlerMgr::ScriptHandlerMgr()
{
}
ScriptHandlerMgr::~ScriptHandlerMgr()
{
CC_SAFE_DELETE(_scriptHandlerMgr);
}
ScriptHandlerMgr* ScriptHandlerMgr::getInstance()
{
if (NULL == _scriptHandlerMgr)
@ -138,6 +139,11 @@ ScriptHandlerMgr* ScriptHandlerMgr::getInstance()
return _scriptHandlerMgr;
}
void ScriptHandlerMgr::destroyInstance()
{
CC_SAFE_DELETE(_scriptHandlerMgr);
}
void ScriptHandlerMgr::init()
{
_mapObjectHandlers.clear();

View File

@ -173,7 +173,8 @@ public:
ScriptHandlerMgr(void);
virtual ~ScriptHandlerMgr(void);
static ScriptHandlerMgr* getInstance(void);
static void destroyInstance(void);
void addObjectHandler(void* object,int handler,ScriptHandlerMgr::HandlerType handlerType);
void removeObjectHandler(void* object,ScriptHandlerMgr::HandlerType handlerType);
int getObjectHandler(void* object,ScriptHandlerMgr::HandlerType handlerType);