Program doesn't always fully close Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Program doesn't always fully close

Post by miclus » Thu Dec 10, 2009 3:55 am

A rare occurrence, but sometimes when I close my program, it keeps the process under task manager. It doesn't crash or anything, just leaves it there though. My OnExit() function does this:

Code: Select all


int MeltdownApp::OnExit()
{

    wxSocketBase::Shutdown();    		
    GeoIP_delete(gcountry);    
    GeoIP_delete(gfull); 
   
    return wxApp::OnExit();
   
}


Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

Post by Allonii » Thu Dec 10, 2009 5:39 pm

Hi miclus!

I guess when you are shutting down you have the socket connected. Do actually disconnected try calling Destroy() or Close() before deleting.

Code: Select all

int MeltdownApp::OnExit()
{

    mySocket->Destroy();//Destroy() calls Close() also.                   
    GeoIP_delete(gcountry);   
    GeoIP_delete(gfull);
   
    return wxApp::OnExit();
   
}
Thanks

Allonii

miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Post by miclus » Thu Dec 10, 2009 6:16 pm

Hi. The shutdown I do is just to match the Initialize I do in OnInit. But, other sockets get destroyed before closing.

Frank
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Jan 01, 2005 6:19 pm

Post by Frank » Fri Dec 11, 2009 1:00 pm

Have you checked *where* your program termination hangs?

I have the same problem. The debugger shows, it hangs in the exit from the CRT (in a WinAPI call).

I never found what's causing this, so I call TerminateProcess(). Ugly, but works...

miclus
Can't get richer than this
Can't get richer than this
Posts: 741
Joined: Tue Mar 31, 2009 2:11 am

Post by miclus » Tue Feb 23, 2010 8:10 am

Ok, I haven't had this issue in a long while, so it's probably gone.

Post Reply