diff options
author | Robin Gareus <robin@gareus.org> | 2018-11-27 13:19:34 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-11-27 13:19:34 +0100 |
commit | 1d8dc009f7e1d8a279335724b03682fa727603ae (patch) | |
tree | 9bc6c3ee647980dff26b840326aaa6871dfdfbd6 /gtk2_ardour/route_ui.cc | |
parent | 57d7b5de65b399fc7d1d61a3a9212c0fa7f1e95c (diff) |
Catch potential exceptions when adding tracks/busses
Diffstat (limited to 'gtk2_ardour/route_ui.cc')
-rw-r--r-- | gtk2_ardour/route_ui.cc | 34 |
1 files 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<Route> 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<boost::shared_ptr<AudioTrack> > tl = - _session->new_audio_track (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::max_order, Normal); - r = tl.front (); - assert (r); - - boost::shared_ptr<ControlList> 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<boost::shared_ptr<AudioTrack> > tl = + _session->new_audio_track (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::max_order, Normal); + r = tl.front (); + assert (r); + + boost::shared_ptr<ControlList> 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<RouteList> rl (&to_group); + _session->remove_routes (rl); + } + return; } r->input ()->disconnect (this); } |