Better version of previous commit

This commit is contained in:
Robin Gareus 2021-05-17 21:22:29 +02:00
parent 9d063943bb
commit d2916a1df8
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 16 additions and 7 deletions

View file

@ -450,6 +450,7 @@ private:
mutable Glib::Threads::RWLock region_lock;
private:
void freeze_locked ();
void setup_layering_indices (RegionList const&);
void coalesce_and_check_crossfades (std::list<Evoral::Range<samplepos_t> >);

View file

@ -453,6 +453,12 @@ Playlist::freeze ()
* before beginning to modify the playlist.
*/
RegionWriteLock rlock (this);
freeze_locked ();
}
void
Playlist::freeze_locked ()
{
delay_notifications ();
g_atomic_int_inc (&ignore_state_changes);
}
@ -2224,9 +2230,9 @@ Playlist::update (const RegionListProperty::ChangeRecord& change)
DEBUG_TRACE (DEBUG::Properties, string_compose ("Playlist %1 updates from a change record with %2 adds %3 removes\n",
name (), change.added.size (), change.removed.size ()));
freeze ();
{
RegionWriteLock rlock (this);
freeze_locked ();
/* add the added regions */
for (RegionListProperty::ChangeContainer::const_iterator i = change.added.begin (); i != change.added.end (); ++i) {
add_region_internal ((*i), (*i)->position (), rlock.thawlist);
@ -2993,15 +2999,17 @@ Playlist::ripple (samplepos_t at, samplecnt_t distance, RegionList* exclude)
void
Playlist::update_after_tempo_map_change ()
{
freeze ();
{
RegionWriteLock rlock (const_cast<Playlist*> (this));
RegionList copy (regions.rlist ());
freeze_locked ();
for (RegionList::iterator i = copy.begin (); i != copy.end (); ++i) {
rlock.thawlist.add (*i);
(*i)->update_after_tempo_map_change ();
}
}
/* possibly causes a contents changed notification (flush_notifications()) */
thaw ();
}