]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix the problem of unit-tests on copy of not-initialized the reference attribute.
authormpv <mpv@opencascade.com>
Wed, 18 Sep 2019 10:34:46 +0000 (13:34 +0300)
committermpv <mpv@opencascade.com>
Wed, 18 Sep 2019 10:35:02 +0000 (13:35 +0300)
src/Model/Model_Data.cpp

index dad2068da15557f5630e5a105aa14c2e61c1990c..10d11678d642420f5bde838baabe2072dce78114 100644 (file)
@@ -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);