Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Signal 10 error all the sudden

Signal 10 error all the sudden
Thread Tools
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Jan 2, 2003, 11:05 PM
 
I have a project that used to run fine, but all the sudden I am getting these annoying signal 10 errors since I upgraded to the Dec dev tools. Is this some sort of a memory error?

thanks,
kman
     
Forum Regular
Join Date: Jan 2002
Location: New York
Status: Offline
Reply With Quote
Jan 3, 2003, 11:21 AM
 
Yes, that means you're trying to access a memory location that doesn't exist anymore. Most likely you're autoreleasing or releasing where you shouldn't be doing so.
     
kman42  (op)
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Jan 3, 2003, 11:57 AM
 
Well. I've made a bit of progress, but I could still use some help. I'm using accessor methods, such as:

Code:
-(void)setArticleVolume:(NSString *)aVolume { [aVolume retain]; [articleVolume release]; articleVolume=aVolume; }
Basically, I'm parsing an XML document using NSScanner to find the beginning/ending tag and then putting the result into the NSString using an accessor method as above.

I've figured out that if I comment out the portions of the code that parse out numbers, then the app runs fine. This doesn't make a lot of sense to me as I think the numbers should be getting treated as just strings. Here's the XML parsing code:

Code:
@implementation XMLParser +(NSString *)parse: (NSString *)stringToBeParsed withBeginningTag:(NSString *)beginningTag withEndingTag: (NSString *)endingTag { NSScanner *theScanner; NSString *parseResults; theScanner = [NSScanner scannerWithString:stringToBeParsed]; [theScanner scanUpToString:beginningTag intoString:NULL]; [theScanner scanString:beginningTag intoString:NULL]; [theScanner scanUpToString:endingTag intoString:&parseResults]; return parseResults; } @end
And here is the code that calls the XML parser:

Code:
[self setArticleAuthors:[XMLParser parse:referenceXML withBeginningTag:@"<LastName>" withEndingTag:@"</LastName>"]]; NSLog(@"here2"); [self setArticleAbstract:[XMLParser parse:referenceXML withBeginningTag:@"<AbstractText>" withEndingTag:@"</AbstractText>"]]; NSLog(@"here3"); // [self setArticleVolume:[XMLParser parse:referenceXML withBeginningTag:@"<Volume>" withEndingTag:@"</Volume>"]]; NSLog(@"here4"); // [self setArticleIssue:[XMLParser parse:referenceXML withBeginningTag:@"<Issue>" withEndingTag:@"</Issue>"]];
You can see where I have commented out the portions dealing with numbers (i.e. journal issues, page numbers, etc).

Any further help would be most appreciated. I think I am just missing something fairly fundamental here.

thanks,
kman
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 4, 2003, 11:24 AM
 
Hmm....

- (BOOL)scanStringNSString *)string intoStringNSString **)stringValue
Scans for string, and, if a match is found, returns an equivalent string object by reference in stringValue. Returns YES if stringValue matches the characters at the scan location; otherwise returns NO.

Invoke this method with nil as stringValue to simply scan past a given string.
Code:
@implementation XMLParser +(NSString *)parse: (NSString *)stringToBeParsed withBeginningTagNSString *)beginningTag withEndingTag: (NSString *)endingTag { NSScanner *theScanner; NSString *parseResults; // nil! //fix?: NSString *parseResults = [NSString string]; theScanner = [NSScanner scannerWithString:stringToBeParsed]; [theScanner scanUpToString:beginningTag intoString:NULL]; [theScanner scanString:beginningTag intoString:NULL]; [theScanner scanUpToString:endingTag intoString:&parseResults]; // NSLog(@"(%@) returning parseResults: %@", self, parseResults); return parseResults; } @end
My guess is you're trying to use the parseResults object even though it's nil...
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 4, 2003, 11:27 AM
 
My last post received a beat-down from the parser but I think it's ok. I should've remembered to turn off the smileys!
     
kman42  (op)
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Jan 4, 2003, 09:15 PM
 
You are correct, sir!!!

After checking, one of the returned XML files contained nothing for some of the fields. I'll pop in some code to correct for the nil return and see if that helps.

Can anyone say, "Error trapping is good coding practice."? Obviously, I can't.

kman
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:00 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2