Skip to content

Commit

Permalink
Merge pull request cocos2d#12836 from pandamicro/v3.7-release
Browse files Browse the repository at this point in the history
Fixed cocos2d#12834 Invoke cleanup function when override in JS
  • Loading branch information
pandamicro committed Jul 14, 2015
2 parents a90a8b1 + efffea5 commit eb56ad6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cocos/scripting/js-bindings/manual/ScriptingCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,11 @@ int ScriptingCore::handleNodeEvent(void* data)
}
else if (action == kNodeOnCleanup) {
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;
Expand Down
2 changes: 1 addition & 1 deletion tests/js-tests/src/tests-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ var TestController = cc.LayerGradient.extend({
return true;
}
}, this);
}
}
},
onEnter:function(){
this._super();
Expand Down

0 comments on commit eb56ad6

Please sign in to comment.