bool PointerInputDevice::ProcessReleaseEvent()
{
+ // 检查 touchableView_ 是否为空,防止空指针解引用
+ if (touchableView_ == nullptr) {
+ return false;
+ }
UIView* parent = touchableView_->GetParent();
// reissue press event.
if (!pressSent_) {
void PointerInputDevice::DispatchLongPressEvent(uint32_t elapse)
{
+ // 检查 touchableView_ 是否为空,防止空指针解引用
+ if (touchableView_ == nullptr) {
+ return;
+ }
if (!longPressSent_ && (elapse > INDEV_LONG_PRESS_TIME)) {
longPressSent_ = true;
LongPressEvent evt(curPos_, pressTimeStamp_);
void PointerInputDevice::DispatchCancelEvent()
{
+ // 检查 touchableView_ 是否为空,防止空指针解引用
+ if (touchableView_ == nullptr) {
+ cancelSent_ = true;
+ return;
+ }
CancelEvent evt(lastPos_);
UIView* parent = touchableView_->GetParent();
if (!touchableView_->OnCancelEvent(evt)) {