From: mpv Date: Wed, 18 Sep 2019 10:34:46 +0000 (+0300) Subject: Fix the problem of unit-tests on copy of not-initialized the reference attribute. X-Git-Tag: V9_4_0a2~4^2~82 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=342677f8b97c05be750aaf1bff1fa4b468c9056c;p=modules%2Fshaper.git Fix the problem of unit-tests on copy of not-initialized the reference attribute. --- diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index dad2068da..10d11678d 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -810,6 +810,12 @@ static void copyAttrs(TDF_Label theSource, TDF_Label theDestination) { // no special relocation, empty map, but self-relocation is on: copy references w/o changes Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable(Standard_True); anAttrIter.Value()->Paste(aTargetAttr, aRelocTable); + // an exception: if a source reference refers itself, a copy must also refer itself + if (aTargetAttr->ID() == TDF_Reference::GetID()) { + Handle(TDF_Reference) aTargetRef = Handle(TDF_Reference)::DownCast(aTargetAttr); + if (aTargetRef->Get().IsEqual(anAttrIter.Value()->Label())) + aTargetRef->Set(aTargetRef->Label()); + } } // copy the sub-labels content TDF_ChildIterator aSubLabsIter(theSource);