Re: uiViewForAudioUnit released immediately?
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.