From 7ebf10936c6ee9b320346d925da77d8c5c62dc4b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me?= Date: Mon, 30 Nov 2020 12:41:06 +0100 Subject: [PATCH] #20296 Close document after reading Step --- src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } -- 2.39.2