Skip to content

Commit

Permalink
Delay Windows shutdown until F@H has shutdown gracefully.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoffland committed Nov 14, 2024
1 parent 6802f20 commit 0205de2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Folding@home Client Changelog
=============================

## v8.4.8
- Delay Windows shutdown until F@H has shutdown gracefully.

## v8.4.7
- Pause group after 5 consecutive lost WUs. #305
- Ensure WU is saved to DB in case shutdown Windows kills the process. #290
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fah-client",
"version": "8.4.7",
"version": "8.4.8",
"bin": {"fah-client": "./fah-client"},
"author": "Joseph Coffland <[email protected]>",
"homepage": "https://foldingathome.org/",
Expand Down
9 changes: 7 additions & 2 deletions src/fah/client/win/WinOSImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,19 @@ void WinOSImpl::run() {
LRESULT WinOSImpl::windowProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam) {
switch (message) {
case WM_DESTROY: case WM_QUERYENDSESSION: case WM_ENDSESSION:
case WM_DESTROY:
Shell_NotifyIcon(NIM_DELETE, &notifyIconData);
if (hWnd) KillTimer(hWnd, ID_UPDATE_TIMER);
OS::requestExit();
PostQuitMessage(0);
hWnd = 0;
return 0;

case WM_QUERYENDSESSION:
OS::requestExit();
if (hWnd) ShutdownBlockReasonCreate(hWnd, L"Folding@home shutting down");
return 0;

case WM_POWERBROADCAST:
if (wParam == PBT_POWERSETTINGCHANGE) {
POWERBROADCAST_SETTING &pbs = *((POWERBROADCAST_SETTING *)lParam);
Expand All @@ -280,7 +285,7 @@ LRESULT WinOSImpl::windowProc(HWND hWnd, UINT message, WPARAM wParam,
case ID_USER_FOLD: OS::setState(STATE_FOLD); return 0;
case ID_USER_PAUSE: OS::setState(STATE_PAUSE); return 0;
case ID_USER_ABOUT: showAbout(hWnd); return 0;
case ID_USER_EXIT: DestroyWindow(hWnd); return 0;
case ID_USER_EXIT: OS::requestExit(); return 0;
}
break;
}
Expand Down

0 comments on commit 0205de2

Please sign in to comment.