On Wed, Oct 1, 2008 at 3:57 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
> After updating from Xcode 3.0 to 3.1.1, my project crashes repeatably in
> 10.3.9, while loading the (old) Sparkle 1.1 framework, and in a couple other
> places.
>
> (Yes, I'm just about to cut my two or remaining Panther users loose and send
> them an old version.  But I always try and fix these things because often I
> find that older OS tests are good canaries in my coal mine.)
>
> This particularly simple crash I find inexplicable:
>
> In an extension (category) method in NSScanner, I have the following code
> which never crashed before and still works fine in 10.4 and 10.5:
>
>  //  string is declared as NSString*
>  //  stringValue is declared as NSString**
>  NSLog(@"string: '%@' len=%d intoString: %p",
>        [self string], [[self string] length], stringValue) ;
>  [self scanUpToString:stopString intoString:stringValue] ;

Without seeing the rest of your code I can't say for sure, but this is
extremely suspect. Do you ever point stringValue anywhere? If you just
do NSString **stringValue; and then pass it to NSScanner, it's a
miracle this ever worked at all. You have a pointer off into
hyperspace and you're telling NSScanner to stomp all over whatever
memory happens to be sitting in the sights.

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];

Mike
_______________________________________________

Cocoa-dev mailing list ([email protected])

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