• 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: NSURLConnection retains its delegate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection retains its delegate


  • Subject: Re: NSURLConnection retains its delegate
  • From: Scott Anguish <email@hidden>
  • Date: Thu, 10 Aug 2006 15:53:46 -0700

I wasn't aware that this was the case.. it does happen rarely though.
some research indicates that yes, it does retain it, but that it is released when the collection has finished loading, fails, or is cancelled.


the doc should state this though. I've filed a bug and will fix this

On Aug 10, 2006, at 9:30 AM, Jonathan del Strother wrote:

I ran into an odd problem recently where my objects that I created to receive a response from an NSURLConnection were never getting released. After several hours of debugging, I finally discovered that NSURLConnection seems to retain its delegate.


BBConnectionHandler* connectionHandler = [[BBConnectionHandler alloc] init]; //connectionHandler has a retain count of 1
NSURLConnection* connection = [NSURLConnection connectionWithRequest:request delegate:connectionHandler];
//connectionHandler now has a retain count of 2.


...which all lead to a rather unpleasant retain cycle that was a pain in the ass to unwind.


Surely this is wrong? I'm sure I remember reading somewhere that objects should not retain their delegates for exactly the above reason. This isn't standard behavior - shouldn't it at least be documented?


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSURLConnection retains its delegate
      • From: Jerry Krinock <email@hidden>
References: 
 >NSURLConnection retains its delegate (From: Jonathan del Strother <email@hidden>)

  • Prev by Date: Re: DocumentController - detect source of request to open document?
  • Next by Date: redrawing an NSPopUpButtonCell, and ghost effect
  • Previous by thread: NSURLConnection retains its delegate
  • Next by thread: Re: NSURLConnection retains its delegate
  • Index(es):
    • Date
    • Thread