@anthony-nicholls
OK, I think I’ve worked around the crash and isolated the reason for it.
I’ll start with the specific plugin that causes the problem, which is the free Magic7 reverb from Wave Alchemy. It definitely has “JUCE Timer” as the name of the thread that’s crashing, so that would seem to indicate that it is the older version of the framework before versions numbers were added.
The first problem was that I had a shared_ptr reference to my custom AudioClient, which is based on the AudioClient code from the VST3 SDK. Because of this, the component’s setActive(false) was never being called, d’oh! So that one’s on me, not the JUCE framework.
Addressing this problem unfortunately did not prevent the crash in JUCE Timer. Here’s what did.
I mentioned in my previous post that I had tried sitting in a loop just before program exit to work around the issue, but that it still crashed.
while (get_current_time_mS() < time_100mS_in_the_future) {
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow: 50 / 1000.0]];
}
the key was changing the code to something like this:
while (get_current_time_mS() < time_100mS_in_the_future) {
usleep(50 * 1000);
}
Now one more clue which may help you, but which applies to almost no developers other than me. (Which may be why it’s a clue.)
My app uses a hand-crafted cross-platform framework for macOS and Windows. For various reasons, this meant I had to make a custom version of NSApplicationMain(argc, argv) which is usually called from main.m to run the program.
What I am not doing in that custom function was calling NSApplication’s terminate:(id)sender method because it has no bearing on the functionality of my framework.
Maybe the timer is relying on the ’ NSApplicationWillTerminateNotification’ notification sent by the terminate method? Or else it is otherwise relying on NSApplication’s terminate:(id)sender method being called?
All of that said, I added a call to [[NSApplication sharedApplication] terminate:nil] just before my program exited, and it did not prevent that crash in the JUCE Timer thread. I still needed the delay loop described above.
Hope that helps!
Mark