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.
Editor::build_region_boundary_cache ()
{
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;
if (!_region_boundary_cache_dirty)
return;
interesting_points.push_back (SyncPoint);
}
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;
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;
if (maybe_first_sample) {
TrackViewList::const_iterator i;
- 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 lpos = max_samplepos;
+ samplepos_t lpos = session_end;
for (vector<RegionPoint>::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) {
for (vector<RegionPoint>::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) {