From aa5b6c70a7edbdf3d7a96cf812d64d88693960c4 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sun, 6 Feb 2022 10:48:04 -0500 Subject: [PATCH] Ensure we close the occt document at the end of loading (cherry picked from commit d211ef1ea3fd5417f35b5a717bc9dcd3a28f8b80) --- plugins/3d/oce/loadmodel.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/3d/oce/loadmodel.cpp b/plugins/3d/oce/loadmodel.cpp index 642b333845..515f00c910 100644 --- a/plugins/3d/oce/loadmodel.cpp +++ b/plugins/3d/oce/loadmodel.cpp @@ -671,24 +671,34 @@ SCENEGRAPH* LoadModel( char const* filename ) data.renderBoth = true; if( !readIGES( data.m_doc, filename ) ) + { + m_app->Close( data.m_doc ); return nullptr; + } break; case FMT_STEP: if( !readSTEP( data.m_doc, filename ) ) + { + m_app->Close( data.m_doc ); return nullptr; + } break; case FMT_STPZ: if( !readSTEPZ( data.m_doc, filename ) ) + { + m_app->Close( data.m_doc ); return nullptr; + } break; default: + m_app->Close( data.m_doc ); return nullptr; break; } @@ -724,7 +734,10 @@ SCENEGRAPH* LoadModel( char const* filename ) } if( !ret ) + { + m_app->Close( data.m_doc ); return nullptr; + } SCENEGRAPH* scene = (SCENEGRAPH*)data.scene; @@ -749,6 +762,8 @@ SCENEGRAPH* LoadModel( char const* filename ) // set to NULL to prevent automatic destruction of the scene data data.scene = nullptr; + m_app->Close( data.m_doc ); + return scene; }