Re: Releasing by reference
Re: Releasing by reference
- Subject: Re: Releasing by reference
- From: apparao <email@hidden>
- Date: Wed, 1 Aug 2007 19:01:26 +0530
If openMovie method is called more than one time from Class A, then
in that case there would be a Memory leak.
I guess, you can do this in one of the two ways:
1. Create and release the QTMovie object in Class A itself.
2. Pass autorelease object to Class B.
On 01-Aug-07, at 6:46 PM, email@hidden wrote:
The implementation is something like this:
Object in class A: [QTMovie movieWithFile:@"/path/to/mov" error:err]
Sent as parameter aMovie to class B:
static QTMovie *mov = nil;
- (QTMovieView *)openMovie: (QTMovie *) aMovie {
mov = aMovie;
}
- dealloc {
if ( mov != nil ) {
[mov release];
mov = nil;
}
}
On 8/1/07, Stephane Sudre <email@hidden> wrote:
On 1 août 07, at 14:02, email@hidden wrote:
Hello!
I'm initializing an object in class A, passing it to class B
where it
is
held in a static variable. I then release the object by
referencing the
variable. Does this also release the original object, or do I
have to
release it in class A?
The answer is probably no but it's difficult to be 100% affirmative
without additional information on your implementation.
_______________________________________________
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:
email@hidden
This email sent to email@hidden
_______________________________________________
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:
40effigent.net
This email sent to email@hidden
_______________________________________________
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