Re: NSTimer crashes after invalidation
Re: NSTimer crashes after invalidation
- Subject: Re: NSTimer crashes after invalidation
- From: Rosyna <email@hidden>
- Date: Tue, 15 Feb 2005 05:02:42 -0700
And once it is retained, replace the repaintTimer!= nil with
[repaintTimer isValid]
Ack, at 2/15/05, M. Uli Kusterer said:
At 1:43 Uhr +0100 15.02.2005, Michael Becker wrote:
if (repaintTimer != nil) {
// This line crashes
[repaintTimer invalidate];
}
repaintTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f
target:[self documentView] selector:@selector(noLiveZoom)
userInfo:nil repeats:NO];
You need to retain the timer. Fire-once timers automatically
invalidate themselves once they have fired, and if you don't retain
the timer, that means it'll be released, and you'll have a stale
pointer lying around in your instance variable.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
_______________________________________________
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