• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
EXC_BAD_ACCESS with NSDate?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: EXC_BAD_ACCESS with NSDate?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: WebServices Question
  • Next by Date: [ANN] Mulle kybernetiK - Optimizing Objective-C code - Articles #3.1 + #9 online
  • Previous by thread: Re: handling of huge bitmaps, incremental saving?
  • Next by thread: Re: EXC_BAD_ACCESS with NSDate?
  • Index(es):
    • Date
    • Thread