• 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: NSXMLParser frees itself on error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLParser frees itself on error?


  • Subject: Re: NSXMLParser frees itself on error?
  • From: Mike Manzano <email@hidden>
  • Date: Mon, 4 May 2009 12:56:16 -0700

I tried doing an autorelease from the delegate and that seemed to work fine. Still not sure if that's entirely correct. I was under the impression that -parse was asynchronous, so therefore I couldn't call release right after it, but if it is indeed synchronous, I'll just stick the release there.

Thank you all for the responses!

Mike


On Apr 30, 2009, at 11:59 PM, Mike Manzano wrote:

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_______________________________________________

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

_______________________________________________

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


References: 
 >NSXMLParser frees itself on error? (From: Mike Manzano <email@hidden>)

  • Prev by Date: Re: sheets
  • Next by Date: Key window/first responder handling with NSDrawer containing NSTextView
  • Previous by thread: Re: NSXMLParser frees itself on error?
  • Next by thread: Re: Writable dir for non-admin user outside user's dir
  • Index(es):
    • Date
    • Thread