Significantly speed up multiple region duplication

When multiple regions are duplicated Playlist::duplicate
is called sequentially for each region.

Previously that lead to a call to Playlist::flush_notifications
after each step, which is rather expensive.
Playlist::ContentsChanged and Playlist::LayeringChanged
trigger SessionEvent::Overwrite and GUI updates.
This commit is contained in:
Robin Gareus 2023-05-14 19:07:57 +02:00
parent e79d8b00f9
commit cfca2d2af9
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 3 additions and 0 deletions

View File

@ -5343,6 +5343,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
/* successfully inserted into set, so it's the first time we've seen this playlist */
playlist->clear_changes ();
playlist->clear_owned_changes ();
playlist->freeze ();
}
}
@ -5383,6 +5384,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
if (playlists.insert (playlist).second) {
playlist->clear_changes ();
playlist->clear_owned_changes ();
playlist->freeze ();
}
}
@ -5394,6 +5396,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
}
for (PlaylistSet::iterator p = playlists.begin(); p != playlists.end(); ++p) {
(*p)->thaw ();
(*p)->rdiff_and_add_command (_session);
}