Re: Re: Passing param by reference then using within block throws exception
Re: Re: Passing param by reference then using within block throws exception
- Subject: Re: Re: Passing param by reference then using within block throws exception
- From: Kyle Sluder <email@hidden>
- Date: Thu, 22 Sep 2016 14:31:11 -0500
On Wed, Sep 21, 2016, at 09:22 AM, Steve Mills wrote:
> On Sep 21, 2016, at 08:53 AM, Alex Zavatone <email@hidden> wrote:
>
> Stab in the dark here, but I'm stabbing blank. Is there an Instruments
> tool or debugging option to detect this?
>
> Thanks for getting stabby. Fourvel appreciates it (only relevant if
> you're a CBB fan). It doesn't appear that anything will detect this. When
> zombies is on, it says an address is attempting to be retained but was
> previously released. That's a bit of a red herring, since the only 2
> variables being uses have just been declared and initialized right before
> the call to the method. If anything, the process of converting to ARC or
> the static analyzer should've flagged this as a problem.
Are you able to reproduce this in a sample app? I tried the following
but got no crash:
#include <stdio.h>
#import <Foundation/Foundation.h>
static void foo(NSString **fillMeIn) {
[@[@"a"] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx,
BOOL *stop) {
*fillMeIn = obj;
*stop = YES;
}];
}
int main(int argc, char **argv) {
@autoreleasepool {
NSString *out;
foo(&out);
printf("%s", out.UTF8String);
}
return 0;
}
--Kyle
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden