Re: Passing param by reference then using within block throws exception

2016-09-22 Thread Steve Mills
On Sep 22, 2016, at 02:45 PM, "Gary L. Wade" wrote: Look at these two lines:    __block NSString* noFillMeIn; ...          *noFillMeIn = @"wow"; Unless the original code is correct, you've got mismatched pointers, and you should try turning on more

Re: Re: Passing param by reference then using within block throws exception

2016-09-22 Thread Steve Mills
On Sep 22, 2016, at 02:31 PM, Kyle Sluder wrote: Are you able to reproduce this in a sample app? I tried the following but got no crash: I haven't tried. The real method this came from is much more complex than my simplified example; 6 enumerate* loop blocks on dicts and

Re: Passing param by reference then using within block throws exception

2016-09-22 Thread Gary L. Wade
Look at these two lines: >__block NSString* noFillMeIn; ... > *noFillMeIn = @"wow"; Unless the original code is correct, you've got mismatched pointers, and you should try turning on more warnings and reading what they say, as well as trying the analyzer. -- Gary L. Wade

Re: Re: Passing param by reference then using within block throws exception

2016-09-22 Thread Kyle Sluder
On Wed, Sep 21, 2016, at 09:22 AM, Steve Mills wrote: > On Sep 21, 2016, at 08:53 AM, Alex Zavatone 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

Re: Passing param by reference then using within block throws exception

2016-09-21 Thread Steve Mills
On Sep 21, 2016, at 08:53 AM, Alex Zavatone 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

Re: Passing param by reference then using within block throws exception

2016-09-21 Thread Alex Zavatone
Stab in the dark here, but I'm stabbing blank. Is there an Instruments tool or debugging option to detect this? On Sep 21, 2016, at 7:53 AM, Steve Mills wrote: > On Sep 21, 2016, at 01:29:37, Jens Alfke wrote: >> >> I think the real problem is that the

Re: Passing param by reference then using within block throws exception

2016-09-21 Thread Steve Mills
On Sep 21, 2016, at 01:29:37, Jens Alfke wrote: > > I think the real problem is that the -enumerateObjectsUsingBlock: method has > an autorelease pool. If your real code is assigning something other than a > string constant to *fillMeIn, that string will probably get

Re: Passing param by reference then using within block throws exception

2016-09-21 Thread Jens Alfke
I think the real problem is that the -enumerateObjectsUsingBlock: method has an autorelease pool. If your real code is assigning something other than a string constant to *fillMeIn, that string will probably get dealloced when the autorelease pool drains. Your workaround is correct, since

Re: Passing param by reference then using within block throws exception

2016-09-20 Thread Doug Hill
I think this is the exact solution. As I'm sure you've tried, you can't use the __block modifier on method parameters, as you will get the following compiler error: __block attribute not allowed, only allowed on local variables So, you're doing the right thing creating the local as a temporary