summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2018-02-24 10:30:52 -0600
committerBen Loftis <ben@harrisonconsoles.com>2018-02-24 10:30:52 -0600
commitf64a39a07f27d13891437a7da98b7f59978ab2d1 (patch)
tree62fd70f959b78377696610cfe6453991285bdcda
parentceac42cc039d9043e0bcf929c6e8207d7f8fc7d4 (diff)
Fixes for region_boundary_cache:
If no region-snaps are defined, bail out before generating cache. Avoid potential overflow at max_samplepos+1 Snap should continue to work beyond the End marker.
-rw-r--r--gtk2_ardour/editor_ops.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index da4e4e3a4f..fba1e2de28 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -708,8 +708,8 @@ void
Editor::build_region_boundary_cache ()
{
- //ToDo: maybe set a timer so we don't recalutate when lots of changes are coming in
- //ToDo: maybe somehow defer this until session is fully loaded.
+ /* TODO: maybe set a timer so we don't recalutate when lots of changes are coming in */
+ /* TODO: maybe somehow defer this until session is fully loaded. */
if (!_region_boundary_cache_dirty)
return;
@@ -741,16 +741,15 @@ Editor::build_region_boundary_cache ()
interesting_points.push_back (SyncPoint);
}
+ /* if no snap selections are set, boundary cache should be left empty */
+ if ( interesting_points.empty() ) {
+ return;
+ }
+
TimeAxisView *ontrack = 0;
TrackViewList tlist;
- //in the past, we used the track selection to limit snap. I think this is not desired.
- //or if it is, it needs to be updated every time the track selection changes (so the snapped-cursor can show it)
-// if (!selection->tracks.empty()) {
-// tlist = selection->tracks.filter_to_unique_playlists ();
-// } else {
- tlist = track_views.filter_to_unique_playlists ();
-// }
+ tlist = track_views.filter_to_unique_playlists ();
if (maybe_first_sample) {
TrackViewList::const_iterator i;
@@ -763,10 +762,13 @@ Editor::build_region_boundary_cache ()
}
}
- while (pos < _session->current_end_sample() && !at_end) {
+ std::pair<samplepos_t, samplepos_t> ext = session_gui_extents (false);
+ samplepos_t session_end = ext.second;
+
+ while (pos < session_end && !at_end) {
samplepos_t rpos;
- samplepos_t lpos = max_samplepos;
+ samplepos_t lpos = session_end;
for (vector<RegionPoint>::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) {