• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSConnection retaining delegate?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSURLConnection retaining delegate?
      • From: Alexander Spohr <email@hidden>
  • Prev by Date: Re: NSOutlineView - How to hide disclosure triangle for root nodes ?
  • Next by Date: Re: NSURLConnection retaining delegate?
  • Previous by thread: NSConnection retaining delegate?
  • Next by thread: Re: NSURLConnection retaining delegate?
  • Index(es):
    • Date
    • Thread