Re: [super dealloc] when init fails. Was: Logging pointer EXC_BAD_ACCESS?

2011-05-29 Thread Jerry Krinock
On 2011 May 29, at 11:38, Stephen J. Butler wrote: On Sun, May 29, 2011 at 1:30 PM, Jerry Krinock je...@ieee.org wrote: I'm really losing it; or maybe I never understood to begin with. How can this code crash? - (void)dealloc { NSLog(@0988 %p %s, self,

Re: [super dealloc] when init fails. Was: Logging pointer EXC_BAD_ACCESS?

2011-05-29 Thread Quincey Morris
On May 29, 2011, at 12:20, Jerry Krinock wrote: Ah, I get it now. It's the access to the pointer m_managedObjectContext itself that's the problem. So, let's look at the subclass init method which invokes -dealloc: - (id)initWithDocUuid:(NSString*)docUuid { NSManagedObjectContext*

Re: [super dealloc] when init fails. Was: Logging pointer EXC_BAD_ACCESS?

2011-05-29 Thread Ken Thomases
On May 29, 2011, at 2:20 PM, Jerry Krinock wrote: So, let's look at the subclass init method which invokes -dealloc: - (id)initWithDocUuid:(NSString*)docUuid { NSManagedObjectContext* moc ; moc = [[BkmxBasis sharedBasis] exidsMocForIdentifier:docUuid] ; self = [super

Re: [super dealloc] when init fails. Was: Logging pointer EXC_BAD_ACCESS?

2011-05-29 Thread Ken Thomases
On May 29, 2011, at 2:43 PM, Quincey Morris wrote: The difference in the second case is that the compiler translates it (AFAIK) into a call to objc_msgSendSuper instead of objc_msgSend. What I'm winding up to here is that the failure in messaging a nil 'super' looks to me like a bug in the

Re: [super dealloc] when init fails. Was: Logging pointer EXC_BAD_ACCESS?

2011-05-29 Thread Quincey Morris
On May 29, 2011, at 12:20, Jerry Krinock wrote: - (id)initWithDocUuid:(NSString*)docUuid { NSManagedObjectContext* moc ; moc = [[BkmxBasis sharedBasis] exidsMocForIdentifier:docUuid] ; self = [super initWithManagedObjectContext:moc

Re: [super dealloc] when init fails. Was: Logging pointer EXC_BAD_ACCESS?

2011-05-29 Thread Quincey Morris
On May 29, 2011, at 12:57, Ken Thomases wrote: But it's important to recognize that there are good arguments on both sides and the design decision involved a tradeoff. In any case, it doesn't seem to me that that design decision necessarily implies that calling super with a nil self

Re: [super dealloc] when init fails. Was: Logging pointer EXC_BAD_ACCESS?

2011-05-29 Thread Jerry Krinock
Thanks, all. Quincey, the three Error Points you defined are great. Fortunately, in this case I have the easy oneā€¦ On 2011 May 29, at 13:03, Quincey Morris wrote: Error point #2 (super returns nil) is easy. Just return nil. because one should assume that the superclass will have cleaned up