Skip to content
Snippets Groups Projects
Commit 3488422a authored by Gabriel Studer's avatar Gabriel Studer
Browse files

fixed bug with possible naming conflicts

When a chain has been inserted in an entity with a ChainHandle as
argument, the name of the given ChainHandle has been used.
The chain then got subsequently renamed to the given name.
This can cause problems, if a chain with the same name as the
input ChanHandle is already present.
parent 20066332
Branches
Tags
No related merge requests found
......@@ -42,8 +42,7 @@ ChainHandle EditorBase::InsertChain(const String& chain_name)
ChainHandle EditorBase::InsertChain(const String& chain_name, ChainHandle chain, bool deep)
{
impl::ChainImplPtr inserted_chain=ent_.Impl()->InsertChain(chain.Impl(), deep);
inserted_chain->SetName(chain_name);
impl::ChainImplPtr inserted_chain=ent_.Impl()->InsertChain(chain_name, chain.Impl(), deep);
return inserted_chain;
}
......
......@@ -126,9 +126,9 @@ EntityImplPtr EntityImpl::Copy()
return ent_p;
}
ChainImplPtr EntityImpl::InsertChain(const ChainImplPtr& chain, bool deep)
ChainImplPtr EntityImpl::InsertChain(const String& chain_name, const ChainImplPtr& chain, bool deep)
{
ChainImplPtr dst_chain=this->InsertChain(chain->GetName());
ChainImplPtr dst_chain=this->InsertChain(chain_name);
dst_chain->Assign(*chain.get());
if(deep)
{
......@@ -147,7 +147,7 @@ void EntityImpl::ReplicateHierarchy(EntityImplPtr dest)
for (ChainImplList::const_iterator i=chain_list_.begin(),
e1=chain_list_.end(); i!=e1; ++i) {
ChainImplPtr src_chain=*i;
dest->InsertChain(src_chain,true);
dest->InsertChain(src_chain->GetName(),src_chain,true);
}
}
......
......@@ -111,7 +111,7 @@ public:
/// The chain will have no residues and atoms
// force deep to be set explicitely, because it is better than implicit
// (and since we are on the impl level interface consistency isn't that critical)
ChainImplPtr InsertChain(const ChainImplPtr& chain, bool deep);
ChainImplPtr InsertChain(const String& chain_name, const ChainImplPtr& chain, bool deep);
ConnectorImplP Connect(const AtomImplPtr& first, const AtomImplPtr& second,
Real len, Real theta, Real phi,
unsigned char bond_order);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment