Re: NSOperation and NSAutoreleasePool
Re: NSOperation and NSAutoreleasePool
- Subject: Re: NSOperation and NSAutoreleasePool
- From: "Stephen J. Butler" <email@hidden>
- Date: Sat, 7 Mar 2009 00:27:59 -0600
On Sat, Mar 7, 2009 at 12:18 AM, Aaron Wallis <email@hidden> wrote:
> The property was assigned as:
> @property (retain) id delegate;
>
> when I walk through the code (and log pretty much everything out)
> I get the following:
>
> - (void)processString:(NSString *)tString withDelegate:(id)tDelegate {
> NSLog(@"1. %@", tDelegate); // I get <TMPSTProcessDropOperation:
> 0x175930>
>
> self.delegate = tDelegate;
>
> NSLog(@"2. %@", self.delegate); // I get <NSAutoreleasePool: 0x187e10>
>
> [self.delegate doSomething]; // I get -[NSAutoreleasePool
> doSomething]: unrecognized selector sent to instance 0x187e10
I'm going to guess that maybe "self" is pointing to a deallocated
instance. Turn on NSZombie checking and see what happens:
<http://www.cocoadev.com/index.pl?NSZombieEnabled>
Another couple things. The delegate pattern says you don't retain the
delegate, to avoid retain cycles (loops). Also, it's a little unusual
to pass the delegate around to various methods. Usually there's one
setDelegate: call (or an Obj-C 2.0 property) and all subsequent
methods use that delegate.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden