rust-block icon indicating copy to clipboard operation
rust-block copied to clipboard

Need to copy the block

Open kvark opened this issue 7 years ago • 1 comments

It is important to copy your block to the heap (with the copy method) before passing it to Objective-C; this is because our ConcreteBlock is only meant to be copied once, and we can enforce this in Rust, but if Objective-C code were to copy it twice we could have a double free.

This is really unfortunate and error prone. It would be great to leverage the type system to do this automatically for us or at least enforce safety at compile time.

kvark avatar May 11 '18 14:05 kvark

How about renaming the copy function and removing the Deref implementations to make the API more explicit?

steven-joruk avatar Apr 05 '20 16:04 steven-joruk