Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to copy the block #9

Open
kvark opened this issue May 11, 2018 · 1 comment
Open

Need to copy the block #9

kvark opened this issue May 11, 2018 · 1 comment

Comments

@kvark
Copy link

kvark commented May 11, 2018

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.

@steven-joruk
Copy link

steven-joruk commented Apr 5, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants