For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Deleting AIS_Context and View causes program to cr

Omar Msaaf's picture
Forums: 

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

Omar Msaaf'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