Re: NSConnection retaining delegate?
Re: NSConnection retaining delegate?
- Subject: Re: NSConnection retaining delegate?
- From: Andy Lee <email@hidden>
- Date: Wed, 25 Nov 2009 15:19:00 -0500
On Wednesday, November 25, 2009, at 12:15PM, "Alexander Spohr" <email@hidden> wrote:
>is NSConnection retaining its delegate?
>(At least as long as it is collecting data)
FWIW I've never used NSConnection, but in the following quick and dirty code it did not retain the delegate I gave it.
TestDelegate * aTestDelegate = [[[TestDelegate alloc] init] autorelease];
NSConnection * aConn = [[NSConnection alloc] initWithReceivePort:nil sendPort:nil];
[aConn setDelegate:aTestDelegate];
The TestDelegate object got dealloced despite being the NSConnection's delegate.
>
>I thought contract is that a delegate is never retained?
I think there is at least one class that breaks the rule about not retaining delegates (and is documented accordingly). I forget which it is and I don't have time to search for it, but it doesn't seem to be NSConnection.
--Andy
_______________________________________________
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