On Wed, Oct 1, 2008 at 8:11 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
>
> On 2008 Oct, 01, at 15:17, Michael Ash wrote:
>
>> Without seeing the rest of your code I can't say for sure, but this is
>> extremely suspect....
>>
>> You should essentially always use this method (and any other method
>> that uses a SomeClass** parameter to "return" values) like this:
>>
>> NSString *stringValue = nil;
>> [scanner scanUpToString:stopString intoString:&stringValue];
>
> Yes, I see what you mean there.  It looks suspicious without the rest of the
> code.  Here is the entire method (without the logging)
>
> - (BOOL)scanUpToAndThenLeapOverString:(NSString*)stopString
>                           intoString:(NSString**)stringValue {
>    [self scanUpToString:stopString intoString:stringValue] ;
>    BOOL result = [self scanString:stopString intoString:NULL] ;
>
>    return result ;
> }
>
> So you see I'm just passing that NSString** through in order to provide this
> handy addition to NSScanner.  I've use this method "all over the place" with
> no trouble.
>
> And in this particular case, my invocation passes NULL for the second
> argument, and it logged as NULL (see original post), so I can't see how that
> value could be a problem.
>
> Anyhow...thanks, Mike.  I shall keep thinking about it.

You're right, this is entirely fine. I had assumed it was a local
variable, but it's actually a parameter. (As an aside, just a bit of
stylistic advice, I always like to name these things with a leading
"out", as in outStringValue, to indicate that they're actually being
used to return things. Helps to reduce confusion in my experience.)

>From your crash, I'd guess that there's a memory management problem
and either the scanner or the stopString parameter have been
deallocated. Not sure why that would only manifest on Panther, but
that's what the backtrace looks like to me. If you can, try running
the app with zombies enabled and see if it gives you any more
information. Even a fairly nontechnical user should be able to do this
if he can follow instructions, by entering a command like this into
his Terminal:

NSZombieEnabled=YES /path/to/your.app/Contents/MacOS/your

(I can't remember if bash is the default shell in 10.3, if not then
the syntax is going to have to be a bit different.)

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to