Re: Unwanted retain
Re: Unwanted retain
- Subject: Re: Unwanted retain
- From: Jens Bauer <email@hidden>
- Date: Thu, 5 Feb 2004 19:14:18 +0100
Hi Clark,
I owe you a thankyou! :)
-I always released the timer after invalidating it.
I don't know whether this would make my application crash or not,
however, I experienced crashes now and then, while clicking the
close-button in a window, where I had a timer running!
If [timer invalidate] *schedules* the timer to be released; eg. doesn't
release it immediately, I can see that my app would crash, when the
timer is invoked.
But if that's not the case, I still wonder why I get that crash; I
don't get it if I don't have any timer installed...
On Thursday, Feb 5, 2004, at 14:44 Europe/Copenhagen, Clark Cox wrote:
[renderTimer invalidate] is documented as:
Stops the receiver from ever firing again and removes it from any run
loops. This is the only way to remove a timer from an NSRunLoop.
Actually, as I understand it, when you schedule the timer, and it is
added to the run loop, the run loop retains it. When you call
invalidate (thereby removing it from the runloop), the runloop does
indeed release the timer. So unless you explicitly retain the timer,
there is no need to release it as that will be taken care of by
invalidate.
Thanks again; I'll go and clean up my source-code... =)
Love,
Jens
_______________________________________________
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.