From 1d8dc009f7e1d8a279335724b03682fa727603ae Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 27 Nov 2018 13:19:34 +0100 Subject: Catch potential exceptions when adding tracks/busses --- gtk2_ardour/route_ui.cc | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 752a951850..f7c4d0cac0 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -2374,19 +2374,27 @@ RouteUI::fan_out (bool to_busses, bool group) std::string bn = BUSNAME; boost::shared_ptr r = _session->route_by_name (bn); if (!r) { - if (to_busses) { - RouteList rl = _session->new_audio_route (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::AudioBus, PresentationInfo::max_order); - r = rl.front (); - assert (r); - } else { - list > tl = - _session->new_audio_track (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::max_order, Normal); - r = tl.front (); - assert (r); - - boost::shared_ptr cl (new ControlList); - cl->push_back (r->monitoring_control ()); - _session->set_controls (cl, (double) MonitorInput, Controllable::NoGroup); + try { + if (to_busses) { + RouteList rl = _session->new_audio_route (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::AudioBus, PresentationInfo::max_order); + r = rl.front (); + assert (r); + } else { + list > tl = + _session->new_audio_track (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::max_order, Normal); + r = tl.front (); + assert (r); + + boost::shared_ptr cl (new ControlList); + cl->push_back (r->monitoring_control ()); + _session->set_controls (cl, (double) MonitorInput, Controllable::NoGroup); + } + } catch (...) { + if (!to_group.empty()) { + boost::shared_ptr rl (&to_group); + _session->remove_routes (rl); + } + return; } r->input ()->disconnect (this); } -- cgit v1.2.3