diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 75ab8b4f2f..bdf9788875 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -432,6 +433,8 @@ private: void coalesce_and_check_crossfades (std::list >); boost::shared_ptr find_regions_at (samplepos_t); + mutable boost::optional > _cached_extent; + samplepos_t _end_space; //this is used when we are pasting a range with extra space at the end bool _playlist_shift_active; }; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index d9953e7e49..76676bd1cc 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -2238,6 +2238,8 @@ Playlist::find_next_region_boundary (samplepos_t sample, int dir) void Playlist::mark_session_dirty () { + _cached_extent.reset (); + if (!in_set_state && !holding_state ()) { _session.set_dirty(); } @@ -2464,8 +2466,13 @@ Playlist::all_regions_empty() const pair Playlist::get_extent () const { + if (_cached_extent) { + return _cached_extent.value (); + } + RegionReadLock rlock (const_cast(this)); - return _get_extent (); + _cached_extent = _get_extent (); + return _cached_extent.value (); } pair