From: Robin Gareus Date: Mon, 16 Mar 2015 14:09:16 +0000 (+0100) Subject: work-around engine dialog crashes. X-Git-Tag: 4.0-rc1~178 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=7b1c7efc1ca2e77d51568b0e8c3b2deb71115d54;p=ardour.git work-around engine dialog crashes. Thanks to brilliant detective work by John E. we can now reveal that the actual crash in EngineControl::print_channel_count() is caused by a seemingly unrelated exception. The root cause however is waves/ASIO backend reporting a buffersize that is not in list of available buffer-sizes it reported earlier. --- diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index dfa22e6035..742dce03f8 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -1013,7 +1013,7 @@ EngineControl::device_changed () if (0 == period) { period = backend->default_buffer_size(device_name); } - buffer_size_combo.set_active_text (bufsize_as_string (period)); + set_active_text_if_present (buffer_size_combo, bufsize_as_string (period)); show_buffer_duration (); } else { buffer_size_combo.set_sensitive (false); @@ -1247,7 +1247,7 @@ EngineControl::maybe_display_saved_state () if (!_desired_sample_rate) { sample_rate_combo.set_active_text (rate_as_string (state->sample_rate)); } - buffer_size_combo.set_active_text (bufsize_as_string (state->buffer_size)); + set_active_text_if_present (buffer_size_combo, bufsize_as_string (state->buffer_size)); /* call this explicitly because we're ignoring changes to the controls at this point. */ @@ -1465,7 +1465,7 @@ EngineControl::set_state (const XMLNode& root) driver_combo.set_active_text ((*i)->driver); device_combo.set_active_text ((*i)->device); sample_rate_combo.set_active_text (rate_as_string ((*i)->sample_rate)); - buffer_size_combo.set_active_text (bufsize_as_string ((*i)->buffer_size)); + set_active_text_if_present (buffer_size_combo, bufsize_as_string ((*i)->buffer_size)); input_latency.set_value ((*i)->input_latency); output_latency.set_value ((*i)->output_latency); midi_option_combo.set_active_text ((*i)->midi_option); @@ -1784,6 +1784,8 @@ EngineControl::get_buffer_size () const uint32_t samples; if (sscanf (txt.c_str(), "%d", &samples) != 1) { + fprintf(stderr, "Find a trout and repeatedly slap the nearest C++ who throws exceptions without catching them.\n"); + fprintf(stderr, "Ardour will likely crash now, giving you time to get the trout.\n"); throw exception (); } @@ -2175,7 +2177,7 @@ EngineControl::engine_running () boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); assert (backend); - buffer_size_combo.set_active_text (bufsize_as_string (backend->buffer_size())); + set_active_text_if_present (buffer_size_combo, bufsize_as_string (backend->buffer_size())); sample_rate_combo.set_active_text (rate_as_string (backend->sample_rate())); buffer_size_combo.set_sensitive (true);