Merge pull request #1690 from dualface/fix_CCCallFunc_script_support

Fix cc call func script support
This commit is contained in:
minggo 2012-12-02 18:26:05 -08:00
commit af530878fd
2 changed files with 12 additions and 6 deletions

View File

@ -406,6 +406,15 @@ bool CCCallFunc::initWithTarget(CCObject* pSelectorTarget) {
return true; return true;
} }
CCCallFunc::~CCCallFunc(void)
{
if (m_nScriptHandler)
{
cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine()->removeScriptHandler(m_nScriptHandler);
}
CC_SAFE_RELEASE(m_pSelectorTarget);
}
CCObject * CCCallFunc::copyWithZone(CCZone *pZone) { CCObject * CCCallFunc::copyWithZone(CCZone *pZone) {
CCZone* pNewZone = NULL; CCZone* pNewZone = NULL;
CCCallFunc* pRet = NULL; CCCallFunc* pRet = NULL;

View File

@ -215,14 +215,11 @@ class CC_DLL CCCallFunc : public CCActionInstant //<NSCopying>
public: public:
CCCallFunc() CCCallFunc()
: m_pSelectorTarget(NULL) : m_pSelectorTarget(NULL)
, m_nScriptHandler(0)
, m_pCallFunc(NULL) , m_pCallFunc(NULL)
, m_nScriptHandler(0)
{ {
} }
virtual ~CCCallFunc() virtual ~CCCallFunc();
{
CC_SAFE_RELEASE(m_pSelectorTarget);
}
/** creates the action with the callback /** creates the action with the callback
@deprecated: This interface will be deprecated sooner or later. @deprecated: This interface will be deprecated sooner or later.
typedef void (CCObject::*SEL_CallFunc)(); typedef void (CCObject::*SEL_CallFunc)();