Skip to content

Commit 61dba75

Browse files
committed
Add PhMainWndEarlyExit
1 parent 7a481ef commit 61dba75

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ProcessHacker/mainwnd.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
PHAPPAPI HWND PhMainWndHandle;
6262
BOOLEAN PhMainWndExiting = FALSE;
63+
BOOLEAN PhMainWndEarlyExit = FALSE;
6364
HMENU PhMainWndMenuHandle;
6465

6566
PH_PROVIDER_REGISTRATION PhMwpProcessProviderRegistration;
@@ -493,6 +494,8 @@ VOID PhMwpOnDestroy(
493494
VOID
494495
)
495496
{
497+
PhMainWndExiting = TRUE;
498+
496499
PhSetIntegerSetting(L"MainWindowTabRestoreIndex", TabCtrl_GetCurSel(TabControlHandle));
497500

498501
// Notify pages and plugins that we are shutting down.
@@ -502,8 +505,8 @@ VOID PhMwpOnDestroy(
502505
if (PhPluginsEnabled)
503506
PhUnloadPlugins();
504507

505-
if (!PhMainWndExiting)
506-
ProcessHacker_SaveAllSettings(PhMainWndHandle);
508+
if (!PhMainWndEarlyExit)
509+
PhMwpSaveSettings();
507510

508511
PhNfUninitialization();
509512

@@ -1836,7 +1839,7 @@ ULONG_PTR PhMwpOnUserMessage(
18361839
{
18371840
case WM_PH_ACTIVATE:
18381841
{
1839-
if (!PhMainWndExiting)
1842+
if (!PhMainWndEarlyExit && !PhMainWndExiting)
18401843
{
18411844
if (WParam != 0)
18421845
{
@@ -1882,12 +1885,12 @@ ULONG_PTR PhMwpOnUserMessage(
18821885
case WM_PH_PREPARE_FOR_EARLY_SHUTDOWN:
18831886
{
18841887
PhMwpSaveSettings();
1885-
PhMainWndExiting = TRUE;
1888+
PhMainWndEarlyExit = TRUE;
18861889
}
18871890
break;
18881891
case WM_PH_CANCEL_EARLY_SHUTDOWN:
18891892
{
1890-
PhMainWndExiting = FALSE;
1893+
PhMainWndEarlyExit = FALSE;
18911894
}
18921895
break;
18931896
case WM_PH_DELAYED_LOAD_COMPLETED:

0 commit comments

Comments
 (0)