Remove region from playlist when the source is destroyed
This fixes the following issue: 1. Import a file to a new track 2. Delete the track 3. Editor Source list: select imported file, -> Remove the selected source -> Yes, remove the Regions and Sources The Track and Region no longer exist in the Editor, only the playlist still exists! The sources to be deleted are found when iterating over whole-file regions in `EditorSources::remove_selected_sources`. Also RegionFactory::get_regions_using_source correctly returns regions, _editor->remove_regions does nothing since there is no RegionView for the given region(s). This then cashes in ``` libs/ardour/playlist.cc:2400: virtual XMLNode& ARDOUR::Playlist::state(bool) const: Assertion `r->sources ().size () > 0 && r->master_sources ().size () > 0' failed. ```
This commit is contained in:
@@ -665,24 +665,14 @@ Playlist::clear_pending ()
|
||||
void
|
||||
Playlist::region_going_away (std::weak_ptr<Region> region)
|
||||
{
|
||||
printf ("Playlist::region_going_away..\n");
|
||||
if (_session.deletion_in_progress ()) {
|
||||
return;
|
||||
}
|
||||
/* Before a region can be destroyed it must already
|
||||
* be removed from all playlists.
|
||||
*/
|
||||
#ifndef NDEBUG
|
||||
std::shared_ptr<Region> r = region.lock();
|
||||
if (!r) {
|
||||
return;
|
||||
if (r) {
|
||||
remove_region (r);
|
||||
}
|
||||
assert (find_region (r->id ()));
|
||||
{
|
||||
RegionReadLock rlock (this);
|
||||
assert (all_regions.find (r) != all_regions.end());
|
||||
}
|
||||
#endif
|
||||
//remove_region (r);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
||||
Reference in New Issue
Block a user