After reading the step file, there will be an exception when closing the application

If I do not read the STEP file, there is no exception.

Here is my reading code:
STEPControl_Reader *reader = new STEPControl_Reader();
IFSelect_ReturnStatus status = reader->ReadFile(file.toUtf8().data());
if (status != IFSelect_RetDone)
return ret;
Standard_Integer NbRoots = reader->NbRootsForTransfer();
Standard_Integer num = reader->TransferRoots();
Standard_Integer number = reader->NbShapes();
for (int rank = 1; rank <= number; ++rank)
delete reader

Exception location:

Standard_Type::~Standard_Type ()
// remove descriptor from the registry
registry_type& aRegistry = GetRegistry();
Standard_ASSERT(aRegistry.UnBind (mySystemName), "Standard_Type::~Standard_Type() cannot find itself in registry",); //!Error

// std::cout << "Unregistering " << mySystemName << ": " << aRegistry.Extent() << std::endl;
Standard::Free (mySystemName);
Standard::Free (myName);

Dmitrii Pasukhin's picture

Hello, can you share a stack?

Pure not-safety C pointer is not recomended to use with Reader. Please use std::shared_ptr or unique_ptr. Reader is a one-time object. All necessary data located in the WorkSession, that can be gotten by its method or setter by constructor.

Best regards, Dmitrii.