diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-22 22:46:31 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-22 22:46:31 +0000 |
commit | 7181a20dc69672510bd0c7ed0efc6abca5894149 (patch) | |
tree | f1762cc8b733f21d549f596642b1f56e114dab5d /libs/ardour/session_state.cc | |
parent | ae3c7234e76e6c26fdbb91ebdd38c28d09877797 (diff) |
don't double-load NestedSource nodes, which are listed both forthe parent/root region and all children; even better, don't list them twice anyway - just for the whole file parent/root region
git-svn-id: svn://localhost/ardour2/branches/3.0@9761 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 5d9967cc98..8022c7670c 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1660,11 +1660,26 @@ Session::load_nested_sources (const XMLNode& node) for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == "Source") { - try { - SourceFactory::create (*this, **niter, true); + + /* it may already exist, so don't recreate it unnecessarily + */ + + XMLProperty* prop = (*niter)->property (X_("id")); + if (!prop) { + error << _("Nested source has no ID info in session state file! (ignored)") << endmsg; + continue; } - catch (failed_constructor& err) { - error << string_compose (_("Cannot reconstruct nested source for region %1"), name()) << endmsg; + + ID source_id (prop->value()); + + if (!source_by_id (source_id)) { + + try { + SourceFactory::create (*this, **niter, true); + } + catch (failed_constructor& err) { + error << string_compose (_("Cannot reconstruct nested source for region %1"), name()) << endmsg; + } } } } |