!407 解决“触发点击事件概率失败”的问题

Merge pull request !407 from youzhi92/20211013
This commit is contained in:
openharmony_ci
2021-10-13 07:44:07 +00:00
committed by Gitee
3 changed files with 8 additions and 4 deletions
+2
View File
@@ -52,6 +52,7 @@ void CallbackExecutor(void *data)
JSValue args[argsLength] = {params->arg};
JSRelease(JSFunction::Call(params->fn, params->vm, args, argsLength));
JSRelease(params->arg);
JSRelease(params->vm);
delete params;
params = nullptr;
}
@@ -126,6 +127,7 @@ void EventUtil::InvokeCallback(JSValue vm, JSValue callback, JSValue event, cons
HILOG_ERROR(HILOG_MODULE_ACE, "EventUtil::InvokeCallback failed: Async task dispatch failure.");
delete params;
params = nullptr;
JSRelease(vm);
JSRelease(event);
}
}
@@ -146,8 +146,8 @@ bool ViewOnSwipeListener::OnDragEnd(UIView& view, const DragEvent &event)
HILOG_DEBUG(HILOG_MODULE_ACE, "OnDragEnd received");
JSValue arg = EventUtil::CreateSwipeEvent(view, event);
EventUtil::InvokeCallback(JSUndefined::Create(), fn_, arg, this);
JSValue vm = GetRootAbilitySlice();
EventUtil::InvokeCallback(vm, fn_, arg, this);
return isStopPropagation_;
}
} // namespace ACELite
@@ -108,7 +108,8 @@ public:
return isStopPropagation_;
}
JSValue arg = EventUtil::CreateEvent(EventUtil::EVENT_CLICK, view, event);
EventUtil::InvokeCallback(JSUndefined::Create(), fn_, arg, this);
JSValue vm = GetRootAbilitySlice();
EventUtil::InvokeCallback(vm, fn_, arg, this);
return isStopPropagation_;
}
@@ -143,7 +144,8 @@ public:
}
JSValue arg = EventUtil::CreateEvent(EventUtil::EVENT_LONGPRESS, view, event);
EventUtil::InvokeCallback(JSUndefined::Create(), fn_, arg, this);
JSValue vm = GetRootAbilitySlice();
EventUtil::InvokeCallback(vm, fn_, arg, this);
return isStopPropagation_;
}