diff options
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/region_selection.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/selection.cc | 12 |
3 files changed, 25 insertions, 9 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index eac9068507..159df414a9 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -4144,7 +4144,10 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) boost::shared_ptr<Playlist> pl = (*x)->region()->playlist(); if (!pl) { - /* impossible, but this handles it for the future */ + /* region not yet associated with a playlist (e.g. unfinished + capture pass. + */ + ++x; continue; } @@ -4203,8 +4206,10 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) /* the pmap is in the same order as the tracks in which selected regions occured */ for (vector<PlaylistMapping>::iterator i = pmap.begin(); i != pmap.end(); ++i) { - (*i).pl->thaw(); - foo.push_back ((*i).pl); + if ((*i).pl) { + (*i).pl->thaw(); + foo.push_back ((*i).pl); + } } if (!foo.empty()) { diff --git a/gtk2_ardour/region_selection.cc b/gtk2_ardour/region_selection.cc index 1a5a556514..c10888a086 100644 --- a/gtk2_ardour/region_selection.cc +++ b/gtk2_ardour/region_selection.cc @@ -98,11 +98,20 @@ bool RegionSelection::contains (RegionView* rv) const /** Add a region to the selection. * @param rv Region to add. - * @return false if we already had the region, otherwise true. + * @return false if we already had the region or if it cannot be added, + * otherwise true. */ bool RegionSelection::add (RegionView* rv) { + if (!rv->region()->playlist()) { + /* not attached to a playlist - selection not allowed. + This happens if the user tries to select a region + during a capture pass. + */ + return false; + } + if (contains (rv)) { /* we already have it */ return false; diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 7735993bc1..886dffb651 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -436,11 +436,13 @@ void Selection::add (RegionView* r) { if (find (regions.begin(), regions.end(), r) == regions.end()) { - regions.add (r); - if (Config->get_link_region_and_track_selection()) { - add (&r->get_time_axis_view()); - } - RegionsChanged (); + bool changed = regions.add (r); + if (Config->get_link_region_and_track_selection() && changed) { + add (&r->get_time_axis_view()); + } + if (changed) { + RegionsChanged (); + } } } |