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

Tyushkov Nikolay wx at softvoile.com
Fri Apr 11 01:02:13 PDT 2008


Hello

I have such problem in my app too:( I have tested a lot of variants a 
few days ago including:
wxExit(); ExitMainLoop(); direct deletion of main frame delete pMainFrame,
or such code
    mainWindow->CloseFlashnote(true); 
    wxIdleEvent t;
    mainWindow->AddPendingEvent(t);
    while (Pending())    Dispatch();

Nothing works correctly simultaneously under XP, Windows  2000 and Vista .

So,  now I am not  trying to _close_  app when EVT_QUERY_END_SESSION is 
arrived. I just save my settings and all. It seems to work well.


> i know there is a previous thread with this topic, but it didn't
> really solve the problem.
>
> I added some additional event handlers and logfile output to the
> minimal sample to describe the problem.
>
> When the application is started and quit using the menu entry or close
> button of the main frame, i get this log:
>
> 04/08/08 17:33:59: MyFrame::OnClose
> 04/08/08 17:33:59: MyFrame::~MyFrame()
> 04/08/08 17:33:59: MyApp::OnExit
>
> OnClose handler called, then frame dtor, then wxApp::Exit().
> That's what i expected.
>
> However, when the system is shut down, i get this:
>
> 04/08/08 17:34:45: MyApp::OnAppQueryEndSession
> 04/08/08 17:34:45: MyFrame::OnClose
> 04/08/08 17:34:45: MyApp::OnAppEndSession
> 04/08/08 17:34:45: MyFrame::OnClose
>
> I receive the EVT_END_SESSION events and the OnClose handler gets
> called, but neither the frame dtor nor wxApp::Exit().
>
> Event if i explicitly call frame->Destroy() or wxApp()::ExitMainLoop()
> in the EVT_END_SESSION event handler this does not change.
>
> Is this the "normal" expected behavior?
>
> Problem is that my application settings are saved in the dtors of
> several different classes and calling them all explictly from the
> EVT_END_SESSION event will be quite some work (and probably lead to
> pretty ugly code)
>
> Thanks for any input.
>   

-- 
Best regards, Nikolay Tyushkov
http://softvoile.com - Work with texts faster!



More information about the wx-users mailing list