From 463bd470e86a37c747a44f2896c48c75b80e81ca Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Sat, 26 Sep 2015 20:22:46 +1000 Subject: [PATCH] Don't hide Audio Setup dialog when clicking 'OK' if engine fails to start This has to be handled in two places, in ARDOUR_UI::do_audio_midi_setup and in the dialogs response handler and in as the window can also be triggered via the window action manager. --- gtk2_ardour/ardour_ui.cc | 22 +++++++++++++++------- gtk2_ardour/engine_dialog.cc | 15 ++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index ee356fb2a9..2a4a8c530d 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -4828,13 +4828,21 @@ ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate) audio_midi_setup->set_desired_sample_rate (desired_sample_rate); audio_midi_setup->set_position (WIN_POS_CENTER); - switch (audio_midi_setup->run()) { - case Gtk::RESPONSE_OK: - return 0; - case Gtk::RESPONSE_APPLY: - return 0; - default: - return -1; + int response; + + while (true) { + response = audio_midi_setup->run(); + switch (response) { + case Gtk::RESPONSE_OK: + if (!AudioEngine::instance()->running()) { + continue; + } else { + return 0; + } + return 0; + default: + return -1; + } } } diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 663702104b..8799d6aa8f 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -415,10 +415,12 @@ EngineControl::on_response (int response_id) switch (response_id) { case RESPONSE_OK: + if (push_state_to_backend (true) != 0) { + return; + } else { + hide (); + } #ifdef PLATFORM_WINDOWS - // For some reason we don't understand, 'hide()' - // needs to get called first in Windows - hide (); // But if there's no session open, this can produce // a long gap when nothing appears to be happening. @@ -430,13 +432,8 @@ EngineControl::on_response (int response_id) } } } - push_state_to_backend (true); - break; -#else - push_state_to_backend (true); - hide (); - break; #endif + break; case RESPONSE_DELETE_EVENT: { GdkEventButton ev;