diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 27cf9b7719..437aea7d39 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -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 backends = ARDOUR::AudioEngine::instance()->available_backends(); + vector backend_names; + + for (vector::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) {