• 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: DO crashes when returning NSError by reference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DO crashes when returning NSError by reference


  • Subject: Re: DO crashes when returning NSError by reference
  • From: Charles Srstka <email@hidden>
  • Date: Sun, 8 Apr 2007 13:12:06 -0500

On Apr 8, 2007, at 9:05 AM, Scotty's Lists wrote:

Charles,

Sorry, I looked closer at the DRMAASession.m file ref I sent you and it's not the most recent rev in the respository.

This link gives you the most recent (and seemingly fully implemented) version of the class.

<http://code.edbaskerville.com/websvn/filedetails.php? repname=XgridDRMAA&path=/trunk/framework/objc% 2FXgridDRMAASession.m&sc=1>

Thanks. I think I've figured out what the problem was. My initial simplification of my code from my original snippet was not entirely accurate. What was actually going on was more like this:


- (BOOL)foo:(NSError **)error
{
	// do a bunch of stuff

	BOOL success = [helper bar:error];

	// do a bunch more stuff
}

The problem was that foo: was sometimes getting called with nil for the "error" parameter, when the caller didn't care about the error message. This got passed on to bar:, which crashed. Apparently, with DO you can't pass NULL for values you don't want that are returned by reference.

This fixed it:

- (BOOL)foo:(NSError **)error
{
	// do a bunch of stuff

	NSError *theError = nil;
	BOOL success = [helper bar:&theError];

	if(error) *error = theError;

	// do a bunch more stuff
}

Charles
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >DO crashes when returning NSError by reference (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: Multiple developers and nib files
  • Next by Date: Re: Multiple developers and nib files
  • Previous by thread: Re: DO crashes when returning NSError by reference
  • Next by thread: Crashing View
  • Index(es):
    • Date
    • Thread