Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
- Subject: Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
- From: Chris Suter <email@hidden>
- Date: Tue, 19 Dec 2006 12:52:50 +1100
On 19/12/2006, at 12:42 PM, John Stiles wrote:
Unless your app is doing very clever things, there isn't any
justification for allocating an autorelease pool without releasing it.
These are particularly tricky because they are implemented in a
stack, and if you do not keep the stack properly balanced, it is
quite easy to make crash-inducing mistakes.
Just to add to that, you should be careful about *not* releasing
autorelease pools when exceptions are involved.
- (void)myMethod
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@try {
// do something
} @catch (NSException *e) {
// Don't be tempted to stick a [pool release] in here
@throw;
} @finally {
// or here
}
[pool release];
}
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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