• 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: uiViewForAudioUnit released immediately?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: uiViewForAudioUnit released immediately?


  • Subject: Re: uiViewForAudioUnit released immediately?
  • From: Luke Bellandi <email@hidden>
  • Date: Fri, 4 Jun 2004 09:39:42 -0700

On Jun 4, 2004, at 9:11 AM, Mark's Studio wrote:

*** snip ***

should the returnView be retained?

If i retain the view, it's working but the view is leaking (all the
subviews are released, if i return [self autorelease] in the init())

Could someone please explain what's is supposed to happen to the view
at the host side.

Views returned from the factory class should be returned (as the docs say) with a retain count of 1 and autoreleased. This is the same behavior the Cocoa factory classes exhibit. For example: [NSMutableArray array] returns a new mutable array with a retain count of 1, and autoreleased.

It's up to the host to retain the view, or the view will be deallocated next time the autorelease pool executes a release on its objects (of which the view is one.)

I would imagine most hosts wouldn't need to do an explicit retain on the view, but would just add it to a view in a window of their app. Adding the view to another view will bump its retain count up by one, thus keeping the view around even after the autorelease pool executes its release (1 + 1 - 1 = 1). Then, once the view is removed from its parent view, the view's retain count will be bumped down 1, and be deallocated (unless it's been retained additionally somewhere else.)

Luke


Peter Mark

Mark's Recording Studio A/S
Lundeskovsvej 3
2900 Hellerup
Denmark
Tel: +45 35366078 Fax: +45 35366038
www.marks-studio.dk
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


References: 
 >uiViewForAudioUnit released immediately? (From: "Mark's Studio" <email@hidden>)

  • Prev by Date: uiViewForAudioUnit released immediately?
  • Next by Date: Re: MIDIOutputPortCreate returning a odd MIDIPortRef
  • Previous by thread: uiViewForAudioUnit released immediately?
  • Next by thread: Newbie component question
  • Index(es):
    • Date
    • Thread