Ensure that regions have sources when saving
Otherwise this will lead to a corrupt state: ERROR: Session: XMLNode describing a AudioRegion references an unknown source id ERROR: Session: cannot create Region from XML description. Can not load state for region ERROR: Playlist: cannot create region from XML and a track without playlist is created, resulting in a later crash. Eventually SessionPlaylists::load() needs to handle this gracefully, but this should help catch cases causing the actual issue.
This commit is contained in:
parent
016eaddad7
commit
a485195453
@ -2409,6 +2409,7 @@ Playlist::state (bool full_state)
|
||||
node->set_property ("combine-ops", _combine_ops);
|
||||
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
assert ((*i)->sources().size() > 0 && (*i)->master_sources().size() > 0);
|
||||
node->add_child_nocopy ((*i)->get_state());
|
||||
}
|
||||
}
|
||||
|
@ -1383,6 +1383,8 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass
|
||||
const RegionFactory::RegionMap& region_map (RegionFactory::all_regions());
|
||||
for (RegionFactory::RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
|
||||
boost::shared_ptr<Region> r = i->second;
|
||||
/* regions must have sources */
|
||||
assert (r->sources().size() > 0 && r->master_sources().size() > 0);
|
||||
/* only store regions not attached to playlists */
|
||||
if (r->playlist() == 0) {
|
||||
if (boost::dynamic_pointer_cast<AudioRegion>(r)) {
|
||||
|
Loading…
Reference in New Issue
Block a user