NSXMLParser frees itself on error?
NSXMLParser frees itself on error?
- Subject: NSXMLParser frees itself on error?
- From: Mike Manzano <email@hidden>
- Date: Thu, 30 Apr 2009 23:59:03 -0700
Hi Folks,
I have an NSXMLParser doing parsing the contents of a URL. It is
allocated like this:
_showsParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
Given a good URL to a parsable XML document, its parserDidEndDocument:
method calls this method:
- (void) cleanupShowParsing {
[_buildingShows removeAllObjects];
[_showsParser abortParsing];
[_showsParser release];
_showsParser = nil;
_currentlyBuildingShows = NO;
}
Note that the parser is aborted and released in here. This seems to
work just fine, multiple times, with no problems. However, if I give
it a URL to non-XML data (should be a 404 page somewhere), it calls
parser:parseErrorOccurred: as expected. This method also calls -
cleanupShowParsing. However, when it is called from here, the program
eventually terminates with:
2009-04-30 23:53:52.573 Revision3[49280:20b] PARSE ERROR: Error
Domain=NSXMLParserErrorDomain Code=5 "Operation could not be
completed. (NSXMLParserErrorDomain error 5.)"
objc[49280]: FREED(id): message shouldContinueAfterFatalError sent to
freed object=0xf305a0
I have verified that 0xf305a0 is indeed _showsParser. Further, I've
verified that if I don't release _showsParser in -cleanupShowParsing,
no error occurs given a non-XML file.
My question is it the case that NSXMLParser frees itself if it
encounters an error, but does NOT free itself on a successful parse of
a document?
Thanks!
Mike
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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