On Jan 26, 2011, at 21:41, Jim Thomason wrote: > It can be trivially repaired by just setting *error = nil upon entry > into the method. That wipes out whatever is dangling around and then > everything behaves correctly. But that's a dippy fix - I should be > able to assume that the error pointer that Cocoa is generating for me > is valid and I can just work with it w/o explicitly wiping it out > first, right?
Well, no. 'error' is an OUTPUT ONLY pointer. Specifically, on entry: 1. 'error' is either NULL (no error information should be returned), or a valid address to return a NSError* into, if an error occurs 2. '*error' is trash (<-- subtle, but important) On output: 1. If 'error' was NULL, you of course don't try to return anything 2. If 'error' is non-null and you return NO, '*error' must point to a valid NSError object that you created 3. If 'error' is non-null and you return YES, '*error' does not need to be preserved (you can set it whatever trash you want) (<-- subtle but important) If I read your post correctly, you're trying to interpret '*error' as input, which is a no-no. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com