• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?


  • Subject: Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
  • From: "Michael Ash" <email@hidden>
  • Date: Wed, 1 Oct 2008 18:17:10 -0400

On Wed, Oct 1, 2008 at 3:57 PM, Jerry Krinock <email@hidden> 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@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

  • Follow-Ups:
    • Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
      • From: Jerry Krinock <email@hidden>
References: 
 >-[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Collections can be simple Attributes in Core Data
  • Next by Date: Re: Play Playlist in iTunes
  • Previous by thread: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
  • Next by thread: Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
  • Index(es):
    • Date
    • Thread