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* moc ;
>    moc = [[BkmxBasis sharedBasis] exidsMocForIdentifier:docUuid] ;
> 
>    self = [super initWithManagedObjectContext:moc
>                                    entityName:constEntityNameStarxid] ;
>    if (!self) {
>        [super dealloc] ;
>    }
> 
>    return self ;
> }
> 
> It seems that either that recommendation is bad, or I misintepreted how to do 
> it.  What's wrong with that init method?

Actually, I think you misinterpreted how to do it. Remember that 'self' and 
'super' are the same object, and you would never write:

        if (!self)
                [self someMethod];

OTOH, if you *did* write that, it ought to be harmless because messaging to 
'nil' is harmless. So this *ought* to be harmless too:

        if (!self)
                [super someMethod];

but you seem to have proved it isn't.

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 ObjC runtime's implementation of objc_msgSendSuper.


_______________________________________________

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

Reply via email to