Hi, I wrote this code, but every time I change item selected (not the first time I select one) in my comboBox it gives me this error “JUCE Message Thread (1): EXC_BAD_ACCESS (code=1, address=0x10)” in line 918 of doc “atomic”:
midiInputList1.onChange = [this] {
for (int i = 0; i<midiSources.size(); i++)
{
if (selectedInFilteredDevice.get() != nullptr) { selectedInFilteredDevice->stop(); }
if (midiInputList1.getSelectedItemIndex() == i)
{
selectedInFilteredDevice.reset(MidiInput::openDevice(i, this).get());
selectedInFilteredDevice->start();
}
}
};
This will delete the object that you then go on to use.
Honestly, if you don’t know how to use std::unique_ptr correctly, then C++ is always going to be a struggle! There are loads of really good, well-written books and articles explaining it, you really should take the time to properly nail your understanding of it.