Skip to content

Commit

Permalink
fix: fix event.target still can be pointed by event after finalized b…
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall committed Nov 16, 2023
1 parent 3e57a7a commit 3da3b77
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion webf/lib/src/bridge/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ void _dispatchEventToNative(Event event, bool isCapture) {
Pointer<NativeBindingObject>? pointer = event.currentTarget?.pointer;
int? contextId = event.target?.contextId;
WebFController controller = WebFController.getControllerOfJSContextId(contextId)!;
if (contextId != null && pointer != null && pointer.ref.invokeBindingMethodFromDart != nullptr) {
if (contextId != null &&
pointer != null &&
pointer.ref.invokeBindingMethodFromDart != nullptr &&
event.target?.pointer?.ref.disposed != true &&
event.currentTarget?.pointer?.ref.disposed != true
) {
BindingObject bindingObject = controller.view.getBindingObject(pointer);
// Call methods implements at C++ side.
DartInvokeBindingMethodsFromDart f = pointer.ref.invokeBindingMethodFromDart.asFunction();
Expand Down

0 comments on commit 3da3b77

Please sign in to comment.