Forum archiveIssue archiveData Exchange and Application Framework

Archived discussion

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

Data Exchange and Application FrameworkWed, 01/18/2023 - 11:043 replies

Browse this forum
QuestionAuthor

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

Discussion

3 archived replies

Posts are displayed in their archived order.

01Commenter-1

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, Commenter-1.

02Author

Sorry for the late reply. I tried using std::share_ ptr, but this issue still exists. Here is a screenshot of the stack.

03Commenter-1

Thank you for stack dump. We will check it. If problem will reproduce, I create a ticket. 

But can you check just a Reader on the stack? without new/delete. Just variable.

Best regards,

Commenter-1.