事件回调中删除自己的异常保护。

This commit is contained in:
u0u0
2023-09-14 21:46:02 +08:00
parent 1c351f0729
commit ff31129b5e

View File

@@ -812,6 +812,9 @@ void Widget::onTouchMoved(Touch *touch, Event* /*unusedEvent*/)
void Widget::onTouchEnded(Touch *touch, Event* /*unusedEvent*/)
{
// if self be released in propagateTouchEvent, may crash at setHighlighted.
// use retain() to avoid such case.
this->retain();
_touchEndPosition = touch->getLocation();
/*
@@ -833,6 +836,7 @@ void Widget::onTouchEnded(Touch *touch, Event* /*unusedEvent*/)
{
cancelUpEvent();
}
this->release();
}
void Widget::onTouchCancelled(Touch* touch, Event* /*unusedEvent*/)