-[NSTimer invalidate] does not guarantee that the timer won't fire?
-[NSTimer invalidate] does not guarantee that the timer won't fire?
- Subject: -[NSTimer invalidate] does not guarantee that the timer won't fire?
- From: Jim Correia <email@hidden>
- Date: Tue, 17 Jan 2006 17:46:15 -0500
I have an object which owns an NSTimer, and the timer target is self.
In -dealloc I do
[timer invalidate];
[timer release];
If the object is deallocated while my app is in the foreground, all
is well. If the object is deallocated while my application is in the
background, the timer fires *after* dealloc has invalidated the
timer, but the target (self) is now a zombie.
The documentation for -[NSTimer invalidate] says:
"This is the only way to remove a timer from an NSRunLoop. The
NSRunLoop removes and releases the timer, either just before the
invalidate method returns or at some later point."
Does this mean that there is no guaranteed way to ensure that a timer
will never fire again when its target is going away? (Or is this
simply a bug that I should write up.)
Thanks,
Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden