[SOLVED] Windows error CRITICAL_SECTION and question

Got this error asking me to report it, so here I am.

CriticalSection::CriticalSection() noexcept
{
// (just to check the MS haven’t changed this structure and broken things…)
static_assert (sizeof (CRITICAL_SECTION) <= sizeof (lock),
“win32 lock array too small to hold CRITICAL_SECTION: please report this JUCE bug!”);

InitializeCriticalSection ((CRITICAL_SECTION*) &lock);

}

As a plus, can someone tell me if I’m doing something wrong?
I just want to send Midi messages whenever I click a button.
Later, I want to send MPE messages, but for now even a simple noteOn is crashing my app.
This particular error started after I added the StartBackgroundTrhead line.

audioDeviceManager.initialise(0, 2, nullptr, true, {}, nullptr);
audioDeviceManager.addMidiInputDeviceCallback({}, this); // [6]
audioDeviceManager.addAudioCallback(this);
auto devices = MidiOutput::getAvailableDevices();
auto defaultDevice = devices[MidiOutput::getDefaultDeviceIndex()];
auto defaultDeviceID = defaultDevice.identifier;
audioDeviceManager.setDefaultMidiOutputDevice(defaultDeviceID);
midiOut->openDevice(defaultDeviceID);
midiOut->startBackgroundThread();

The idea was

juce::MidiMessage midiMsg;
midiMsg = juce::MidiMessage();
double timeStamp = Time::getMillisecondCounter();
midiMsg.setTimeStamp(timeStamp);
midiMsg = MidiMessage::noteOff(1, 37, DEFAULT_VELOCITY);
    midiOut->sendMessageNow(midiMsg);

OK, midiOut was declared as pointer, not as unique_prt.
After I changed that, the CRITICAL_SECTION error ceased to appear, as well as the notes played.
(with and without the startbackgroundThread)