@@ -433,7 +433,7 @@ intptr_t InitDartApiDL(void *data) {
433
433
434
434
typedef std::function<void ()> Work;
435
435
436
- void NotifyDart (Dart_Port send_port, const Work* work) {
436
+ BOOL NotifyDart (Dart_Port send_port, const Work* work) {
437
437
const intptr_t work_addr = reinterpret_cast <intptr_t >(work);
438
438
439
439
Dart_CObject dart_object;
@@ -444,6 +444,7 @@ void NotifyDart(Dart_Port send_port, const Work* work) {
444
444
if (!result) {
445
445
NSLog (@" Native callback to Dart failed! Invalid port or isolate died" );
446
446
}
447
+ return result;
447
448
}
448
449
449
450
DN_EXTERN
@@ -475,8 +476,8 @@ void NotifyBlockInvokeToDart(DNInvocation *invocation,
475
476
}
476
477
};
477
478
const Work* work_ptr = new Work (work);
478
- NotifyDart (wrapper.dartPort , work_ptr);
479
- if (sema) {
479
+ BOOL success = NotifyDart (wrapper.dartPort , work_ptr);
480
+ if (sema && success ) {
480
481
dispatch_semaphore_wait (sema, DISPATCH_TIME_FOREVER);
481
482
}
482
483
}
@@ -504,8 +505,8 @@ void NotifyMethodPerformToDart(DNInvocation *invocation,
504
505
}
505
506
};
506
507
const Work* work_ptr = new Work (work);
507
- NotifyDart (methodIMP.dartPort , work_ptr);
508
- if (sema) {
508
+ BOOL success = NotifyDart (methodIMP.dartPort , work_ptr);
509
+ if (sema && success ) {
509
510
dispatch_semaphore_wait (sema, DISPATCH_TIME_FOREVER);
510
511
}
511
512
}
0 commit comments