From 5fc1116f3374e5d27ea7f449a30940379dc18f6e Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Mon, 18 Aug 2014 13:17:15 -0400 Subject: [PATCH] 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. --- clientgui/BOINCGUIApp.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index bf55d7e527..151f93398f 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -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,