From 495dd2e52ab6df1bbdde5a491703090e29268535 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Mon, 10 Aug 2015 21:44:29 +1000 Subject: [PATCH] Compare the string returned by backend->driver_name() against driver names in EngineControl Don't assume an empty string has any meaning and compare string returned with enumerated drivers --- gtk2_ardour/engine_dialog.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 8ccb27d3d6..a222790450 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -915,27 +915,24 @@ EngineControl::set_driver_popdown_strings () boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); vector drivers = backend->enumerate_drivers(); - if (drivers.empty()) { + if (drivers.empty ()) { // This is an error...? return false; } - string current_driver; - current_driver = backend->driver_name (); + string current_driver = backend->driver_name (); DEBUG_ECONTROL (string_compose ("backend->driver_name: %1", current_driver)); - // driver might not have been set yet - if (current_driver == "") { - current_driver = driver_combo.get_active_text (); - if (current_driver == "") - // driver has never been set, make sure it's not blank - current_driver = drivers.front (); + if (std::find (drivers.begin (), drivers.end (), current_driver) == + drivers.end ()) { + + current_driver = drivers.front (); } set_popdown_strings (driver_combo, drivers); DEBUG_ECONTROL ( - string_compose ("driver_combo.set_active_text: %1", current_driver)); + string_compose ("driver_combo.set_active_text: %1", current_driver)); driver_combo.set_active_text (current_driver); return true; }