MIDI Devices closing when hiding sidepanel

I have a sidepanel that I’m using as a preferences menu. Within the sidepanel is a tabbedcomponent with 4 tabs, one is for MIDI I/O device selection. I have no problem opening a connection to devices while the sidepanel is visible, however the connections disappear once the sidepanel is hidden. Here are the relevant blocks of code for the sidepanel/tabbedcomponent:

juce::SidePanel sidepanelPreferences { "PREFERENCES", 1000, false, nullptr, false };

PluginEditor.cpp constructor:

auto sidePanelPreferencesBody = new PreferencesEditor();
sidepanelPreferences.setContent(sidePanelPreferencesBody, false);
sidePanelPreferencesBody->preferencesDismissButtonClicked([&]() { preferencesDismissButtonClicked(); } );


    tabs.addTab("GLOBAL",     juce::Colours::transparentBlack, new globalPrefs, false);
    tabs.addTab("MIDI I/O",   juce::Colours::transparentBlack, new midiPrefs, false);
    tabs.addTab("LED STRIPS", juce::Colours::transparentBlack, new ledPrefs, false);
    tabs.addTab("TRIGGERS",   juce::Colours::transparentBlack, new triggersPrefs, false);

When the sidepanel is closed, the “preferencesDismissButtonClicked” function just calls this, and nothing else:

My MIDI prefs .h & .cpp files are taken verbatim from the MidiDemo.h example. I just removed the keyboard component & midi messages readout, so all that’s left is the midi in & out device listboxes.

Is there anything I can do to keep the MIDI device connections open when the sidepanel is hidden?

Bump. Anyone?

Perhaps your midi ins/outs are being destroyed accidentally when the panel closes. You could try sticking a breakpoint in the destructor of MidiInput and MidiOutput and see whether they get called when the side panel closes. If they do, you can use the stack trace to find out exactly why the ins/outs are being destroyed.

I tried putting DBG("…"); in the destructors of MidiInput and MidiOutput and they don’t get called when the panel is hidden.