NSTimer crashing on fire
NSTimer crashing on fire
- Subject: NSTimer crashing on fire
- From: Jeremy Dronfield <email@hidden>
- Date: Fri, 23 Apr 2004 18:44:54 +0100
I'm making some really elementary mistake here, but can't figure out
what it is. I've ploughed through the docs and the archives, but can't
find anything that answers this specific problem. The situation is
this: I'm using a timer to launch an Unlicensed message after a period
of inactivity (kind of similar to OmniWeb, but using a window). This is
the method called (triggered by the user making a selection in the
application's table view):
- (void)startNagTimer
{
if (nagTimer != nil) {
[nagTimer invalidate];
[nagTimer release];
}
if (nagWindow != nil) {
[nagWindow close];
[nagWindow release];
}
if (nagTimer == nil) {
nagTimer = [[NSTimer scheduledTimerWithTimeInterval:10.0 target:self
selector: @selector(runNagWindow:) userInfo:nil repeats:NO] retain];
}
}
The first time through, the timer is started. On subsequent calls (user
has clicked the table view), the timer is invalidated and restarted. If
the timer is left long enough to fire, the nag window is launched.
Then, when the table is clicked again, the window goes away. This is
where it goes wrong. After it has fired and been recreated, it crashes
when it tries to fire again.
So, should I be looking for problems in the selector (i.e. something in
the method causing trouble in the run loop), or is it just that my
whole use of NSTimer is up the creek? In case it's relevant, all the
-runNagWindow: method does is create a window with a text view and some
text. The window is transparent and its level is NSStatusWindowLevel.
Regards
-Jeremy
_______________________________________________
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.