closed #2535: TouchScriptHandlerEntry will release twice lua reference

This commit is contained in:
James Chen 2014-02-20 21:58:20 +08:00
parent 23082c0d6c
commit 68eaa746ea
2 changed files with 9 additions and 6 deletions

View File

@ -53,7 +53,12 @@ ScriptHandlerEntry* ScriptHandlerEntry::create(int handler)
ScriptHandlerEntry::~ScriptHandlerEntry(void)
{
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_handler);
if (_handler != 0 )
{
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_handler);
LUALOG("[LUA] Remove event handler: %d", _handler);
_handler = 0;
}
}
// #pragma mark -
@ -101,8 +106,6 @@ TouchScriptHandlerEntry* TouchScriptHandlerEntry::create(int handler,
TouchScriptHandlerEntry::~TouchScriptHandlerEntry(void)
{
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_handler);
LUALOG("[LUA] Remove touch event handler: %d", _handler);
}
bool TouchScriptHandlerEntry::init(bool isMultiTouches, int priority, bool swallowsTouches)

View File

@ -62,7 +62,7 @@ public:
* @js NA
* @lua NA
*/
~ScriptHandlerEntry(void);
virtual ~ScriptHandlerEntry();
int getHandler(void) {
return _handler;
@ -103,7 +103,7 @@ public:
* @js NA
* @lua NA
*/
~SchedulerScriptHandlerEntry(void);
virtual ~SchedulerScriptHandlerEntry();
/**
* @js NA
* @lua NA
@ -162,7 +162,7 @@ public:
* @js NA
* @lua NA
*/
~TouchScriptHandlerEntry(void);
virtual ~TouchScriptHandlerEntry();
/**
* @js NA
* @lua NA