From f64a39a07f27d13891437a7da98b7f59978ab2d1 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Sat, 24 Feb 2018 10:30:52 -0600 Subject: 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. --- gtk2_ardour/editor_ops.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'gtk2_ardour') 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 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::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) { -- cgit v1.2.3