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:


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.


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?


Calling repaint() a bunch of times?


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.