Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » PostNcDestroy(). Issue Collapse All
Subject Author Date
Debabrata Mukherjee Nov 16, 2007 - 8:42 AM

I have CView derived class that needs to be destroyed at the end shutdown of my application . Here is the destructor.

CSaIsPresentationView::~CSaIsPresentationView()
{
CView::PostNcDestroy();
    delete this;
}

But in debug mode, it does not give a clean shutdown and goes to a virtual hang, with the stack pointing at the destructor. multiple times.

Can you suggest a way out. Obviously this started to happen after integration with Prof-UIS

Technical Support Nov 26, 2007 - 1:32 PM

The Invalid Argument Exception problem is not the first problem. At least we are sure that delete this; cannot be invoked in the destructor of any class.

Debabrata Mukherjee Nov 24, 2007 - 11:36 PM

The issue is still not resolved. If I remove the "delete this", a CInvalid Arguement Exception" is thrown while closing my application.
Please reply urgently

Suhai Gyorgy Nov 27, 2007 - 1:30 AM

You should remove both CView::PostNcDestroy and delete this from your destructor. So your destructor should be empty.

Technical Support Nov 16, 2007 - 1:31 PM

The source code of this destructor is not incorrect. You should not delete the same class in its destructor. You should not try to invoke PostNcDestroy() either. MFC views and frame windows are destroyed and delete themselves automatically. I.e. the CView::PostNcDestroy() method invokes the delete this; code itself.