Re: Cleanup inside a failed init method

2008-12-08 Thread John Engelhart
On Sat, Dec 6, 2008 at 4:07 PM, Ken Tozier <[EMAIL PROTECTED]> wrote: > Hi > > I'm writing my own socket class using a bunch of BSD functions and am a > little unclear on exactly what I should be doing to insure everything is > cleaned up if any of the low level functions fail. If I return nil from

Re: Cleanup inside a failed init method

2008-12-07 Thread Jens Bauer
Hi Chuck, On Dec 7, 2008, at 03:00, Charles Steinman wrote: I'm sorry, I think I misunderstood the following line (due to the way we say things in Danish): Happily, the object should be released anyway if you plan to return nil since otherwise you'll leak a half-initialized object every ti

Re: Cleanup inside a failed init method

2008-12-06 Thread Charles Steinman
- Original Message > From: Jens Bauer <[EMAIL PROTECTED]> > Subject: Re: Cleanup inside a failed init method > > On Dec 6, 2008, at 22:36, Charles Steinman wrote: > > > The system will only call dealloc if the object is released. Happily, the > objec

Re: Cleanup inside a failed init method

2008-12-06 Thread Michael Ash
On Sat, Dec 6, 2008 at 4:53 PM, Adam R. Maxwell <[EMAIL PROTECTED]> wrote: > I used the [self release] pattern for a long time, but this thread indicates > that you should clean up in the initializer, then call [super dealloc] > directly: > > http://lists.apple.com/archives/objc-language/2008//Sep/

Re: Cleanup inside a failed init method

2008-12-06 Thread Jens Bauer
Hi Chuck, On Dec 6, 2008, at 22:36, Charles Steinman wrote: The system will only call dealloc if the object is released. Happily, the object should be released anyway if you plan to return nil since otherwise you'll leak a half-initialized object every time the method fails. So you should

Re: Cleanup inside a failed init method

2008-12-06 Thread mmalcolm crawford
mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or mode

Re: Cleanup inside a failed init method

2008-12-06 Thread Ken Tozier
It's a matter of preference I guess. In practice, I can't think of any reason to connect to a server unless you intend to talk to it, so I just wrapped up all the ugliness into a nice simple interface. Creating one of my KClientSockets, connects to the host and retrieves any handshake data

Re: Cleanup inside a failed init method

2008-12-06 Thread Steven W Riggins
Should initWithHost be doing anything other than caching the host info? Other methods should do the connection/verification etc, no? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the

Re: Cleanup inside a failed init method

2008-12-06 Thread Adam R. Maxwell
On Dec 6, 2008, at 1:36 PM, Charles Steinman wrote: From: Ken Tozier <[EMAIL PROTECTED]> To: Cocoa Developers I'm writing my own socket class using a bunch of BSD functions and am a little unclear on exactly what I should be doing to insure everything is cleaned up if any of the low leve

Re: Cleanup inside a failed init method

2008-12-06 Thread Charles Steinman
- Original Message > From: Ken Tozier <[EMAIL PROTECTED]> > To: Cocoa Developers > Sent: Saturday, December 6, 2008 1:07:00 PM > Subject: Cleanup inside a failed init method > > Hi > > I'm writing my own socket class using a bunch of BSD functio

Cleanup inside a failed init method

2008-12-06 Thread Ken Tozier
Hi I'm writing my own socket class using a bunch of BSD functions and am a little unclear on exactly what I should be doing to insure everything is cleaned up if any of the low level functions fail. If I return nil from my init, does the system call my dealloc method to allow proper clean