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

Vadim Zeitlin vadim at wxwidgets.org
Wed Apr 16 15:53:37 PDT 2008


On Wed, 16 Apr 2008 22:16:12 +0200 Eric Jensen <ml at j-dev.de> wrote:

EJ> VZ>  Normally wxEntryCleanup will delete the application, do you mean it
EJ> VZ> doesn't happen during your test?
EJ> yes, the wxApp dtor will not get called. Actually it seems the very
EJ> last call that is executed during cleanup is
EJ> ::DestroyWindow(GetHwnd())
EJ> in
EJ> wxWindowMSW::~wxWindowMSW()
EJ> if it's called for the last toplevel window.

 Hmm, this is still pretty bad then as plenty of cleanup code (at least
dtor of wxApp and also dtors of all the global objects) is still not being
executed. I wonder if we can work around this by creating a dummy window in
wxApp::OnEndSession() (not a wxWindow as it would be destroyed too, but
just call ::CreateWindow())? If this fails (because I can imagine Windows
refusing to create windows during shutdown) we'd have to somehow avoid the
destruction of the existing windows, e.g. maybe by setting their m_hWnd
member to NULL from OnEndSession().

 But before embarking on this, could you please test if the simple solution
of calling CreateWindow() works by chance?

 Thanks again for your testing!
VZ

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



More information about the wx-users mailing list