nicely handle the (should-never-happen) case of no audio/MIDI backends being detected
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 10 Oct 2013 15:24:16 +0000 (11:24 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 10 Oct 2013 15:24:16 +0000 (11:24 -0400)
gtk2_ardour/ardour_ui.cc
gtk2_ardour/engine_dialog.cc

index d09544fcf4b784b092d2b8f65a6961eb5079b90a..fe773d94e8630fc0a19d97e96c300bb9bf7835f2 100644 (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 */
 
index dfd24af739f863828859c9b0bed1534f9707a9d9..c9ebcf4cf2c8693bc035cd772b8ded9206c59210 100644 (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);
        }