EXC_BAD_ACCESS with NSDate?
EXC_BAD_ACCESS with NSDate?
- Subject: EXC_BAD_ACCESS with NSDate?
- From: Jonathan del Strother <email@hidden>
- Date: Tue, 30 Dec 2003 00:33:38 +0000
I'm trying to put an FPS counter in my program.
My drawRect method used to update the screen looks something like this:
- (void)drawRect:(NSRect)rect
{
static NSDate* lastFrameTime = NULL;
if (lastFrameTime == NULL)
lastFrameTime = [NSDate date];
// Draw stuff here!
NSTimeInterval elapsed = [lastFrameTime timeIntervalSinceNow] *
-1.0; //!!!
fpsFloat = 1.0/elapsed;
lastFrameTime = [NSDate date];
}
However, on the 3rd time through, the app crashes, claiming that it
'has exited due to signal 10 (SIGBUS).'
If I debug the app, it tells me 'Program received signal:
"EXC_BAD_ACCESS".', when it reaches the line marked with !!! in the
above code.
Any ideas why? And is this the best way of doing a simple fps counter?
Thanks,
Jon
_______________________________________________
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.