Fixed #12834 Invoke cleanup function when override in JS

This commit is contained in:
pandamicro 2015-07-14 15:35:29 +08:00
parent 365c51cfab
commit efffea5b91
2 changed files with 6 additions and 1 deletions

View File

@ -1034,6 +1034,11 @@ int ScriptingCore::handleNodeEvent(void* data)
} }
else if (action == kNodeOnCleanup) { else if (action == kNodeOnCleanup) {
cleanupSchedulesAndActions(p); cleanupSchedulesAndActions(p);
if (isFunctionOverridedInJS(JS::RootedObject(_cx, p->obj.get()), "cleanup", js_cocos2dx_Node_cleanup))
{
ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "cleanup", 1, &dataVal, &retval);
}
} }
return ret; return ret;

View File

@ -176,7 +176,7 @@ var TestController = cc.LayerGradient.extend({
return true; return true;
} }
}, this); }, this);
} }
}, },
onEnter:function(){ onEnter:function(){
this._super(); this._super();