Skip to content

Commit 0205de2

Browse files
committed
Delay Windows shutdown until F@H has shutdown gracefully.
1 parent 6802f20 commit 0205de2

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Folding@home Client Changelog
22
=============================
33

4+
## v8.4.8
5+
- Delay Windows shutdown until F@H has shutdown gracefully.
6+
47
## v8.4.7
58
- Pause group after 5 consecutive lost WUs. #305
69
- Ensure WU is saved to DB in case shutdown Windows kills the process. #290

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fah-client",
3-
"version": "8.4.7",
3+
"version": "8.4.8",
44
"bin": {"fah-client": "./fah-client"},
55
"author": "Joseph Coffland <joseph@cauldrondevelopment.com>",
66
"homepage": "https://foldingathome.org/",

src/fah/client/win/WinOSImpl.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,19 @@ void WinOSImpl::run() {
246246
LRESULT WinOSImpl::windowProc(HWND hWnd, UINT message, WPARAM wParam,
247247
LPARAM lParam) {
248248
switch (message) {
249-
case WM_DESTROY: case WM_QUERYENDSESSION: case WM_ENDSESSION:
249+
case WM_DESTROY:
250250
Shell_NotifyIcon(NIM_DELETE, &notifyIconData);
251251
if (hWnd) KillTimer(hWnd, ID_UPDATE_TIMER);
252252
OS::requestExit();
253253
PostQuitMessage(0);
254254
hWnd = 0;
255255
return 0;
256256

257+
case WM_QUERYENDSESSION:
258+
OS::requestExit();
259+
if (hWnd) ShutdownBlockReasonCreate(hWnd, L"Folding@home shutting down");
260+
return 0;
261+
257262
case WM_POWERBROADCAST:
258263
if (wParam == PBT_POWERSETTINGCHANGE) {
259264
POWERBROADCAST_SETTING &pbs = *((POWERBROADCAST_SETTING *)lParam);
@@ -280,7 +285,7 @@ LRESULT WinOSImpl::windowProc(HWND hWnd, UINT message, WPARAM wParam,
280285
case ID_USER_FOLD: OS::setState(STATE_FOLD); return 0;
281286
case ID_USER_PAUSE: OS::setState(STATE_PAUSE); return 0;
282287
case ID_USER_ABOUT: showAbout(hWnd); return 0;
283-
case ID_USER_EXIT: DestroyWindow(hWnd); return 0;
288+
case ID_USER_EXIT: OS::requestExit(); return 0;
284289
}
285290
break;
286291
}

0 commit comments

Comments
 (0)