If OnInit fails, program crashes Topic is solved
If OnInit fails, program crashes
On my program I test if it is already open and if it is, OnInit() returns false and was suposed to close the aplication. But instead it crashes.
Debuging I saw that it crashes after it returns false it crashes when the function wxEntryCleanup calls delete app.
I have no idea what the problems is. Is there any clue of what could cause this
thanks
Debuging I saw that it crashes after it returns false it crashes when the function wxEntryCleanup calls delete app.
I have no idea what the problems is. Is there any clue of what could cause this
thanks
Here it is
header
This is about it. Any ideas?
Code: Select all
DECLARE_APP(CSPPCOMMApp)
IMPLEMENT_APP(CSPPCOMMApp)
CSPPCOMMApp::CSPPCOMMApp() : wxApp()
{
}
bool CSPPCOMMApp::OnInit()
{
if (ProcessActive("SPPCOMFG.EXE") != 0 )
{
ErrMessage(IDS_APLIC_DISP,1,"");
return false;
}
}
Code: Select all
class CSPPCOMMApp : public wxApp
{
public:
CSPPCOMMApp();
virtual bool OnInit();
virtual int OnExit();
};
Code: Select all
CSPPCOMMApp::CSPPCOMMApp() : wxApp()
{
}
Use the source, Luke!
I removed it and the error continued.
It is a heap problem. It happens when wx tries to delete the application class in the following function.
Everything goes fine until delete app, and in the debug I saw that app is pointing to the correct class. So what could be the problem???
thanks
It is a heap problem. It happens when wx tries to delete the application class in the following function.
Code: Select all
void wxEntryCleanup()
{
DoCommonPreCleanup();
// delete the application object
if ( wxTheApp )
{
wxTheApp->CleanUp();
// reset the global pointer to it to NULL before destroying it as in
// some circumstances this can result in executing the code using
// wxTheApp and using half-destroyed object is no good
wxAppConsole * const app = wxApp::GetInstance();
wxApp::SetInstance(NULL);
delete app;
}
DoCommonPostCleanup();
}
thanks