Deleting AIS_Context and View causes program to cr

Hello, As myAISContext and myViewer are created using a new operator, i Try to call the Delete Operator of these two variables in my Document Destructor. This causes my Program crashing. Can some one explain me how to do it well. I mean deleting those two pointers ?? Thanxs Omar Msaaf

Stephane Routelous's picture

Hello,

As soon as the V3d_Viewer and the AIS_InteractiveContext are classes using Cascade Smart poiters, you don't need to destroy them ( it should be automatically done when the object is not used anymore ).

BTW, if you want to nullify the C++ pointer in this Handle class, you can use the function Nullify

Ex :

Handle_V3d_Viewer theViewer = new V3d_Viewer(....);

theViewer.Nullify();

Take care using Nullify. It can be dangerous.

Stephane

Msaaf Omar's picture

The main reason was in a bug wen i opened a saved document where i saved some objects. I couldn't see them but when i used my mouse i saw the wireframe. By using delete myAISContext; I overrided this error. And my prog doesn't crash anymore. Thanxs for your help