On Wednesday, November 25, 2009, at 12:15PM, "Alexander Spohr" 
<a...@freeport.de> 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 (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