13
0

purge states of Audio-backends that are N/A

fixes crashes/assert() when using different builds while
sharing ardour.rc with n/a engine backends marked active.
This commit is contained in:
Robin Gareus 2014-07-04 15:50:34 +02:00
parent a86c98df7a
commit 63d81d2419

View File

@ -1337,6 +1337,21 @@ EngineControl::set_state (const XMLNode& root)
/* now see if there was an active state and switch the setup to it */
// purge states of backend that are not available in this built
vector<const ARDOUR::AudioBackendInfo*> backends = ARDOUR::AudioEngine::instance()->available_backends();
vector<std::string> backend_names;
for (vector<const ARDOUR::AudioBackendInfo*>::const_iterator i = backends.begin(); i != backends.end(); ++i) {
backend_names.push_back((*i)->name);
}
for (StateList::iterator i = states.begin(); i != states.end();) {
if (std::find(backend_names.begin(), backend_names.end(), (*i)->backend) == backend_names.end()) {
i = states.erase(i);
} else {
++i;
}
}
for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
if ((*i)->active) {