From 342677f8b97c05be750aaf1bff1fa4b468c9056c Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 18 Sep 2019 13:34:46 +0300 Subject: [PATCH] Fix the problem of unit-tests on copy of not-initialized the reference attribute. --- src/Model/Model_Data.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.39.2