From 39c583f7aca57067e5093ca7c4dc3ecf903d3777 Mon Sep 17 00:00:00 2001 From: Tess Strickland Date: Mon, 21 Oct 2024 13:33:53 +0200 Subject: [PATCH] Do not invoke the field directly, but get the closure and invoke that. --- third_party/tonic/logging/dart_invoke.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/third_party/tonic/logging/dart_invoke.cc b/third_party/tonic/logging/dart_invoke.cc index abdcc82c29f33..27001e865b650 100644 --- a/third_party/tonic/logging/dart_invoke.cc +++ b/third_party/tonic/logging/dart_invoke.cc @@ -13,8 +13,15 @@ Dart_Handle DartInvokeField(Dart_Handle target, const char* name, std::initializer_list args) { Dart_Handle field = Dart_NewStringFromCString(name); - return Dart_Invoke(target, field, args.size(), - const_cast(args.begin())); + if (Dart_IsError(field)) { + return field; + } + Dart_Handle closure = Dart_GetField(target, field); + if (Dart_IsError(closure)) { + return closure; + } + return Dart_InvokeClosure(closure, args.size(), + const_cast(args.begin())); } Dart_Handle DartInvoke(Dart_Handle closure,