-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-ffi
Description
We should disallow Pointer in Dart_NewWeakPersistentHandle and Dart_NewFinalizableHandle.
-
Pointers do not have identity. We might want to optimize them to just be integers later.
-
Also the nested structs and inline arrays representation does not keep original pointers alive:
class Foo extends Struct {
external Bar bar;
}
class Bar extends Struct {
Int32()
external int a;
}
void main(){
Pointer<Foo> fooPointer = calloc();
// Attach native finalizer to `fooPointer` using `Dart_NewWeakPersistentHandle` or `Dart_NewFinalizableHandle`.
Foo foo = fooPointer.ref;
Bar bar = foo.bar;
// GC
bar.a; // undefined behavior.
}This is a breaking change.
ds84182
Metadata
Metadata
Assignees
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-ffi