Ensure we close the occt document at the end of loading

This commit is contained in:
Marek Roszko 2022-02-06 10:48:04 -05:00
parent 79f80c4cd7
commit d211ef1ea3
1 changed files with 15 additions and 0 deletions

View File

@ -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;
}