MGR: On Windows Vista and newer, let the service control manager shutdown the core client to prevent crash dialogs from appearing on some peoples systems when Windows is shutting down.

This commit is contained in:
Rom Walton 2014-08-18 13:17:15 -04:00
parent db483f664e
commit 5fc1116f33
1 changed files with 10 additions and 0 deletions

View File

@ -819,6 +819,16 @@ int CBOINCGUIApp::OnExit() {
void CBOINCGUIApp::OnEndSession(wxCloseEvent& ) {
s_bSkipExitConfirmation = true;
// On Windows Vista with UAC turned on, we have to spawn a new process to change the
// state of a service. When Windows is shutting down it'll prevent new processes from
// being created. Sometimes it'll present a crash dialog for the newly spawned application.
//
// So, we will just let the OS shutdown the service via the service control manager.
//
if (m_iShutdownCoreClient && m_pDocument->m_pClientManager->IsBOINCConfiguredAsDaemon()) {
m_iShutdownCoreClient = false;
}
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxID_EXIT);
// The event loop has already been stopped,