I’m writing a VST plugin which creates a virtual MIDI output, the end goal of which is to send things like MIDI clock which normally a VST host would disregard. Anyways, the actual MIDI stuff seems to be working fine, but whenever I remove the plugin I get a crash on destruction. The backtrace looks something like this for the plugin’s thread:
However, the thread that’s crashing is the one created by the MidiOutput object. That thread’s backtrace is very short:
My code is really quite simple. I’ve tried #if 0’ing out pretty much everything except for creating the MIDI output in prepareToPlay(), and the following code in the destructor (btw it also crashes when moved to releaseResources()):
BeatCounterAudioProcessor::~BeatCounterAudioProcessor()
{
if(virtualMidiOutput) {
virtualMidiOutput->clearAllPendingMessages();
virtualMidiOutput->stopBackgroundThread();
delete virtualMidiOutput;
virtualMidiOutput = nullptr;
}
}
What’s going on here? Is this a totally bad idea to try starting a virtual MIDI output from a VST plugin? Or am I just missing something rather obvious?