nicely handle the (should-never-happen) case of no audio/MIDI backends being detected

This commit is contained in:
Paul Davis 2013-10-10 11:24:16 -04:00
parent 465b800d8b
commit c4b20f1a20
2 changed files with 13 additions and 1 deletions

View File

@ -796,7 +796,11 @@ ARDOUR_UI::starting ()
* audio backend end up.
*/
audio_midi_setup.get (true);
try {
audio_midi_setup.get (true);
} catch (...) {
return -1;
}
/* go get a session */

View File

@ -30,6 +30,7 @@
#include "pbd/error.h"
#include "pbd/xml++.h"
#include "pbd/unwind.h"
#include "pbd/failed_constructor.h"
#include <gtkmm/alignment.h>
#include <gtkmm/stock.h>
@ -94,6 +95,13 @@ EngineControl::EngineControl ()
*/
vector<const ARDOUR::AudioBackendInfo*> backends = ARDOUR::AudioEngine::instance()->available_backends();
if (backends.empty()) {
MessageDialog msg (string_compose (_("No audio/MIDI backends detected. %1 cannot run\n\n(This is a build/packaging/system error. It should never happen.)"), PROGRAM_NAME));
msg.run ();
throw failed_constructor ();
}
for (vector<const ARDOUR::AudioBackendInfo*>::const_iterator b = backends.begin(); b != backends.end(); ++b) {
strings.push_back ((*b)->name);
}