• 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
-[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
  • From: Jerry Krinock <email@hidden>
  • Date: Wed, 1 Oct 2008 12:57:58 -0700

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

Which produces the following console output

11:26:47.431 Bookdog[420] string: 'Choose %0' len=9 intoString: 0x0

As you can see, the arguments to scanUpToString:intoString are a string
object of length 9, and NULL.  According to the method documentation,
this is fine.  NULL means to not return the scanned string.

But it produces the following crash in 10.3.9:

OS Version:     10.3.9 (Build 7W98)
Report Version: 2

Thread:  0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000020

Thread 0 Crashed:
0 libobjc.A.dylib 0x908611ec objc_msgSend + 0xc
1 com.apple.Foundation 0x90a25378 -[NSString rangeOfString:options:range:] + 0x44
2 com.apple.Foundation 0x90a4e570 -[NSScanner scanUpToString:intoString:] + 0x120
3 com.sheepsystems.Bookdog 0x0007dcf0 -[NSScanner(GeeWhiz) scanUpToAndThenLeapOverString:intoString:] + 0x9c
4 com.sheepsystems.SSLocalize 0x00160eb8 -[NSString(SSLocalize) countOccurrencesOfSubstring:] + 0xcc
5 com.sheepsystems.SSLocalize 0x00161304 +[NSString(SSLocalize) replacePlaceholdersInString:argPtr_p:] + 0x38
6 com.sheepsystems.SSLocalize 0x00161168 +[NSString(SSLocalize) localizeFormat:] + 0xec
7 com.sheepsystems.Bookdog 0x00049d20 -[BookdogController changedBuiltInBrowfilesNotification:] + 0x4b8
8 com.sheepsystems.Bookdog 0x0004bc00 -[BookdogController applicationDidFinishLaunching:] + 0x358
...


In the new Xcode 3.1.1, I see that the target SDK and Deployment Target settings have been made more readable, and then they now look like this:

GCC_VERSION = 4.0
SDKROOT = macosx10.4
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.4
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.3

That looks to me like it should work.

What could cause such behavior? Of course, it could be that I broke something else and this has nothing to do with my Xcode upgrade. Looking down the stack there, my -[NSString (SSLocalize) localizeFormat:] method is kind of tricky, taking varargs and passing the argument pointer to replacePlaceholdersInString:argPtr_p:, but I haven't had any trouble since I wrote it a year or so ago and worked the bugs out of it.

Thanks,

Jerry Krinock


_______________________________________________

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: "Michael Ash" <email@hidden>
  • Prev by Date: Re: NSString's "mutableCopy" creating a leak?
  • Next by Date: Re: NSString's "mutableCopy" creating a leak?
  • Previous by thread: Re: Finding other apps' paths - deterministically!
  • Next by thread: Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
  • Index(es):
    • Date
    • Thread