Skip to content

[Bug]: How to handle block function #655

Answered by kirb
zacard-orc asked this question in Questions
Discussion options

You must be logged in to vote

You may need to copy the block. By default a block is NSStackBlock, which as you can imagine, is expected to only live for a short period of time entirely on the stack. Copying will give you an NSMallocBlock that can live in the heap. As the original block is an NSMallocBlock, you likely need to do that to match. Blocks respond to -copy, so you can try:

return %orig(arg1, arg2, [respblock copy]);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zacard-orc
Comment options

Answer selected by zacard-orc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #654 on June 26, 2022 04:16.