• 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: Retaining NSInputStream working with NSStream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retaining NSInputStream working with NSStream


  • Subject: Re: Retaining NSInputStream working with NSStream
  • From: Christoffer Lerno <email@hidden>
  • Date: Fri, 28 May 2004 09:32:34 +0800

On May 28, 2004, at 00:42, Chris Parker wrote:

On May 27, 2004, at 12:28 AM, Christoffer Lerno wrote:

NSStream has the method +(void)getStreamsToHost:port:inputStream:outputStream

You throw in a NSInputStream** for an inputStream argument and similar for the outputstream. Now my question is: What the heck is the status for these streams? Did they got assigned autoreleased streams or did I get something that is retained? I.e. should I do a [inputStream retain] after this method or not??

Hrm. There really should at least be a comment in the documentation on the web about that, but the standard Cocoa retain/release rules apply: if you didn't create it via alloc/init, you should be doing your own retain/releases on it.

In this case, the streams you get back from this call have already had the autorelease message sent to them.

Thanks. I suspected this was the case, but then I saw code someone else had written which seemingly omitted the retain, which made me a little confused. Since this was the first time I actually called on a obj-c message which used callbacks, I was not sure if the rules applied.

/Christoffer
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Retaining NSInputStream working with NSStream
      • From: Prachi Gauriar <email@hidden>
References: 
 >Retaining NSInputStream working with NSStream (From: Christoffer Lerno <email@hidden>)
 >Re: Retaining NSInputStream working with NSStream (From: Chris Parker <email@hidden>)

  • Prev by Date: Re: Flattening Mac resource files?
  • Next by Date: Re: Handling Undo/Redo in KVC To-Many Accessors
  • Previous by thread: Re: Retaining NSInputStream working with NSStream
  • Next by thread: Re: Retaining NSInputStream working with NSStream
  • Index(es):
    • Date
    • Thread