You don’t need to inherit from Timer
as the callAfterDelay
method is static, thus you can just write Timer::callAfterDelay(...)
If the point is to ensure the reposition
call is definitely made on the message thread you could instead call MessageManager::callAsync(...)
https://docs.juce.com/master/classMessageManager.html#acfe6da5271c2ab76fdb0414b235ed095
What you’re seeing at the moment is this
is no longer valid on the off chance the Timer
call happens just as you’re closing down, I’m not 100% sure that callAsync
will be immune from this either, someone with a bit more knowledge will have to chime in, but you could always capture it in a SafePointer
https://docs.juce.com/master/classComponent_1_1SafePointer.html
Also I assume you have confirmed that the parameterChanged
callback is happening on the audio thread? In which case I’d be concerned about the parameterID == "xParam_" + (juce::String)m_ID
and if that is allocating or not.
Another thing to verify is if either callAfterDelay
or callAsync
are allocating.
A better option may well be to have a standard timer and a “dirty” flag that you set in the parameterChanged
callback, then you can call reposition
from the timer callback if the flag is true.
Sorry that these are a bit wooly answers, hopefully someone who knows more can chime in.