[ffigen] Nicer error messages when ObjC Blocks are invoked after deletion.
Open
good first issue
package:ffigen
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 47
Description
Currently if an ObjC block is invoked by native code after it has been deleted, we get a null assertion failure here, because `block.ref.target.address` is some junk value:
```Dart
void _ObjCBlock_ffiVoid_CMPedometerData_NSError_closureTrampoline(
ffi.Pointer<_ObjCBlock> block,
ffi.Pointer arg0,
ffi.Pointer arg1) =>
_ObjCBlock_ffiVoid_CMPedometerData_NSError_closureRegistry[
block.ref.target.address]!(arg0, arg1);
// ^ NPE here
```
Instead we should throw an exception with an error message explaining that this is probably caused by the block having been deleted.
Contributor guide
Assessment
This issue has not been assessed yet.