mirror of https://github.com/axmolengine/axmol.git
Fix widget onEnter override in JS may cause infinite recursion
This commit is contained in:
parent
3a58668d71
commit
0a31199a5b
|
@ -223,6 +223,14 @@ bool Widget::init()
|
|||
|
||||
void Widget::onEnter()
|
||||
{
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
if (ScriptEngineManager::sendNodeEventToJSExtended(this, kNodeOnEnter))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!_usingLayoutComponent)
|
||||
updateSizeAndPosition();
|
||||
ProtectedNode::onEnter();
|
||||
|
@ -230,6 +238,14 @@ void Widget::onEnter()
|
|||
|
||||
void Widget::onExit()
|
||||
{
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
if (_scriptType == kScriptTypeJavascript)
|
||||
{
|
||||
if (ScriptEngineManager::sendNodeEventToJS(this, kNodeOnExit))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
unscheduleUpdate();
|
||||
ProtectedNode::onExit();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue