Hi all
we have an object that gets initialized like most other objects
-(id)init
{
self = [ super init ];
if ( self ){
...do something;
}
return self;
}
if [ super init ] returns nil does this cause a leak, as the memory
has already been
Apple's take on this is that when an initializer fails, then it should
call release on itself and return nil.
See: http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#/
/apple_ref/doc/uid/TP30001163-CH22-SW13
This means that if super returns nil,
Le 19 mai 09 à 18:24, Reza Farhad a écrit :
Hi all
we have an object that gets initialized like most other objects
-(id)init
{
self = [ super init ];
if ( self ){
...do something;
}
return self;
}
if [ super init ] returns nil does this cause
On May 19, 2009, at 09:32, Jesper Storm Bache wrote:
I personally disagree with the Apple recommendation, and I vote for
calling [super dealloc] when initialization fails - because this
will invoke dealloc only in the base classes where init succeeded.
First of all, in general, it can't
On May 19, 2009, at 10:58 AM, Quincey Morris wrote:
On May 19, 2009, at 09:32, Jesper Storm Bache wrote:
I personally disagree with the Apple recommendation, and I vote for
calling [super dealloc] when initialization fails - because this
will invoke dealloc only in the base classes where init
On May 19, 2009, at 2:15 PM, Jesper Storm Bache wrote:
In the obj-c world we then have to implement classes to be able to
handle a dealloc call before the initializer has completely executed.
My 2 cents...
If we aren't implementing our classes this way to begin with, then
we're not
On Tue, May 19, 2009 at 2:24 PM, Gwynne Raskind gwy...@darkrainfall.org wrote:
On May 19, 2009, at 2:15 PM, Jesper Storm Bache wrote:
In the obj-c world we then have to implement classes to be able to handle
a dealloc call before the initializer has completely executed.
My 2 cents...
If we
On May 19, 2009, at 9:37 AM, Jean-Daniel Dupas wrote:
Le 19 mai 09 à 18:24, Reza Farhad a écrit :
Hi all
we have an object that gets initialized like most other objects
-(id)init
{
self = [ super init ];
if ( self ){
...do something;
}
return
I did talk to an Apple engineer about this and when I argued for
[super dealloc] I was told that it would be fine.
I then logged a radar against the seemingly incorrect documentation, I
got a reply stating that [self release] is the recommended approach by
the AppKit team.
My radar was