From: Jérôme Date: Mon, 30 Nov 2020 11:41:06 +0000 (+0100) Subject: #20296 Close document after reading Step X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7ebf10936c6ee9b320346d925da77d8c5c62dc4b;p=modules%2Fshaper.git #20296 Close document after reading Step --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp index 4710b2668..807d4f86d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp @@ -76,12 +76,12 @@ std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, // dummy XCAF Application to handle the STEP XCAF Document Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication(); // XCAF Document to contain the STEP/IGES file itself - Handle(TDocStd_Document) doc; + Handle(TDocStd_Document) adoc; - dummy_app->NewDocument( TCollection_ExtendedString("MDTV-CAF"), doc); + dummy_app->NewDocument( TCollection_ExtendedString("MDTV-CAF"), adoc); // transfer STEP/IGES into the document, and get the main label - theReader.Transfer(doc); - TDF_Label mainLabel = doc->Main(); + theReader.Transfer(adoc); + TDF_Label mainLabel = adoc->Main(); Handle_XCAFDoc_ShapeTool shapeTool = XCAFDoc_DocumentTool::ShapeTool(mainLabel); Handle_XCAFDoc_ColorTool colorTool = XCAFDoc_DocumentTool::ColorTool(mainLabel); Handle(XCAFDoc_MaterialTool) materialTool = XCAFDoc_DocumentTool::MaterialTool(mainLabel); @@ -114,6 +114,8 @@ std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, } } } + if (adoc->CanClose() == CDM_CCS_OK) + adoc->Close(); return ageom; }