• 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: Unwanted retain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unwanted retain


  • Subject: Re: Unwanted retain
  • From: Lorenzo <email@hidden>
  • Date: Thu, 05 Feb 2004 08:06:43 +0100

Sorry, I didn't explain well.
I wanted to say that I call "release" from the class that created the
object. Not the superclass.


Best Regards
--
Lorenzo
email: email@hidden

> From: Dustin Voss <email@hidden>
> Date: Wed, 04 Feb 2004 17:55:31 -0800
> To: Lorenzo <email@hidden>
> Cc: Cocoa-Dev Apple <email@hidden>
> Subject: Re: Unwanted retain
>
> On 4 Feb, 2004, at 4:46 PM, Lorenzo wrote:
>
>> Hi,
>> thank to everybody.
>> Thanks for explaining so well the timer retains the target object.
>> My error was that I released the timer within the dealloc object
>> method.
>> This way:
>>
>> - (void)dealloc
>> {
>> if(renderTimer){
>> [renderTimer invalidate];
>> [renderTimer release];
>> renderTimer = nil;
>> }
>>
>> [super autorelease];
>> }
>>
>> So when my superclass released my object, the object could have not
>> been
>> deallocated properly.
>>
>> Now I relase the timer using a different method like
>> [myObject relaseTimer];
>> [myObject release];
>
> You still have the wrong idea. First, when an object is deallocated, it
> is NOT released from NSObject down. NSObject's dealloc method is the
> last one to get called. So it is not the superclass that deallocates
> your class, but rather it has to be your class that deallocates the
> superclass.
>
> You do this by calling [super dealloc]. Don't call [super autorelease].
>
> Also, do not call [renderTimer release]. [renderTimer invalidate] will
> take care of that for you. The documentation does not make this clear,
> though it should.
>
> If you do this, I think you'll find that you don't need a separate
> releaseTimer method.
_______________________________________________
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.

References: 
 >Re: Unwanted retain (From: Dustin Voss <email@hidden>)

  • Prev by Date: Re: NSDate
  • Next by Date: Re: NSDate
  • Previous by thread: Re: Unwanted retain
  • Next by thread: Re: Unwanted retain
  • Index(es):
    • Date
    • Thread