Currently, when a KWSpy receives a message, it makes a copy of the NSInvocation object and retains the parameters. In the case of a block object that is on the stack, however, retaining it is not enough. This causes a crash when the NSInvocation is later deallocated (when the spy is deallocated) and the runtime attempts to release the block object that was retained. By this time, a stack-allocated block will have been overwritten, and the release will be sent to an invalid object.
Currently, when a KWSpy receives a message, it makes a copy of the NSInvocation object and retains the parameters. In the case of a block object that is on the stack, however, retaining it is not enough. This causes a crash when the NSInvocation is later deallocated (when the spy is deallocated) and the runtime attempts to release the block object that was retained. By this time, a stack-allocated block will have been overwritten, and the release will be sent to an invalid object.