statically allocate midi-options

fixes possible segfault when the data in the vector
goes out of scope due to RVO.
This commit is contained in:
Robin Gareus 2014-06-23 11:56:58 +02:00
parent 371bf59a94
commit fb51bdb892
4 changed files with 18 additions and 10 deletions

View file

@ -38,6 +38,7 @@ using namespace ARDOUR;
static std::string s_instance_name;
size_t AlsaAudioBackend::_max_buffer_size = 8192;
std::vector<std::string> AlsaAudioBackend::_midi_options;
AlsaAudioBackend::AlsaAudioBackend (AudioEngine& e, AudioBackendInfo& info)
: AudioBackend (e, info)
@ -403,11 +404,12 @@ AlsaAudioBackend::midi_device_info(std::string const name) const {
std::vector<std::string>
AlsaAudioBackend::enumerate_midi_options () const
{
std::vector<std::string> m;
m.push_back (_("None"));
m.push_back (_("ALSA raw devices"));
m.push_back (_("ALSA sequencer"));
return m;
if (_midi_options.empty()) {
_midi_options.push_back (_("None"));
_midi_options.push_back (_("ALSA raw devices"));
_midi_options.push_back (_("ALSA sequencer"));
}
return _midi_options;
}
std::vector<AudioBackend::DeviceStatus>

View file

@ -302,6 +302,7 @@ class AlsaAudioBackend : public AudioBackend {
bool _freewheeling;
bool _measure_latency;
static std::vector<std::string> _midi_options;
std::string _audio_device;
std::string _midi_driver_option;