[msw 2.8.7] Problem saving application settings when system is shut down

Vadim Zeitlin vadim at wxwidgets.org
Tue Apr 15 15:14:53 PDT 2008


On Tue, 15 Apr 2008 22:21:43 +0200 Eric Jensen <ml at j-dev.de> wrote:

EJ> VZ>  Could you please check if
EJ> 
EJ> VZ> 	void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
EJ> VZ> 	{
EJ> VZ> 		// Windows will terminate the process soon after we
EJ> VZ> 		// return from WM_ENDSESSION handler anyhow, so make
EJ> VZ> 		// sure we at least execute our cleanup code before
EJ> VZ> 		const int rc = OnExit();
EJ> 
EJ> VZ> 		wxEntryCleanup();
EJ> 
EJ> VZ> 		// calling exit() instead of ExitProcess() or not doing
EJ> VZ> 		// anything at all and being killed by Windows has the
EJ> VZ> 		// advantage of executing the dtors of global objects
EJ> VZ> 		exit(rc);
EJ> VZ> 	}
EJ> 
EJ> VZ> works correctly?
EJ> 
EJ> this code seems to work fine. I tested once again with a small sample
EJ> any my own application. I also tested it using the RMTool.exe from the
EJ> Vista SDK (which sends the WM_ENDSESSION, but does not kill the
EJ> application).

 Interesting, I didn't know about it, what exactly is it part of? I don't
have it in my VC9 installation (which normally installs Vista SDK).

EJ> I didn't have an debugging environment on the Vista machine

 You probably should be able to use remote debugging from the machine where
VC is installed.

EJ> If this code makes it into the library, maybe it should be mentioned
EJ> in the docs that the wxApp dtor will not get called if the
EJ> WM_ENDSESSION is received, so if anyone has important cleanup code in
EJ> his dtor, he can move the code to wxApp::OnExit().

 Normally wxEntryCleanup will delete the application, do you mean it
doesn't happen during your test?

 Thanks,
VZ

-- 
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/



More information about the wx-users mailing list