Timer issue (Bad access)

I got a fun one. I’m building a plugin, can’t really share everything about it, but if this bug persists I will try my best to minimize the code down to where it still bugs so that I could post the code here. I’m getting:

EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

And in the comment right above the jassert it says “shouldn’t get to this point, if you get this, let me know” (see: juce_Timer.cpp:266, called from juce_Timer:191). I must admit I have quite a few timer objects running in my plugin, but I do not grok or grasp why this is happening.

NB I have quite a few of them running on 50ms. Maybe that is a culprit here?

Well, if you’ve managed to trigger that assertion and make the timer class blow up, most likely is that you’ve got some dangling pointers or other messed-up objects going on.

if you’re using Timer::callAfterDelay() also check the target functionToCall’s lifetime.

Rail

Thanks both of you. For those looking at this later; I had a reference counted object with errors (off by one in array) in the constructor. Somehow, everything just kept going until it all collapsed on this.

@jules Could this exception occur when the timerCallback routine takes longer than its interval?

Nope

Calling repaint() a bunch of times?

Nope.

It’s a super-robust class. You won’t crash it unless you do something silly like use a dangling pointer to a timer or corrupt some memory.