Timer issue (Bad access)


#1

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.


#2

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


#3

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.


#4

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

Rail


#5

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.


#6

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


#7

Nope


#8

Calling repaint() a bunch of times?


#9

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.