mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-21 02:11:25 +00:00
- delay the restart action from the error pane until after everything has been shut down.
This cannot be done from a place where the old instance still can write to the config file, which happens only in the shutdown process.
This commit is contained in:
parent
b6156ac490
commit
4505bfa4b8
2 changed files with 19 additions and 5 deletions
|
@ -545,6 +545,20 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool restartrequest;
|
||||
|
||||
void CheckForRestart()
|
||||
{
|
||||
if (restartrequest)
|
||||
{
|
||||
HMODULE hModule = GetModuleHandleW(NULL);
|
||||
WCHAR path[MAX_PATH];
|
||||
GetModuleFileNameW(hModule, path, MAX_PATH);
|
||||
ShellExecuteW(NULL, L"open", path, GetCommandLineW(), NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
restartrequest = false;
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK ErrorPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
|
@ -559,11 +573,7 @@ INT_PTR CALLBACK ErrorPaneProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
|
|||
{
|
||||
if (LOWORD(wParam) == IDC_BUTTON1) // we pressed the restart button, so run GZDoom again
|
||||
{
|
||||
HMODULE hModule = GetModuleHandleW(NULL);
|
||||
WCHAR path[MAX_PATH];
|
||||
GetModuleFileNameW(hModule, path, MAX_PATH);
|
||||
|
||||
ShellExecuteW(NULL, L"open", path, GetCommandLineW(), NULL, SW_SHOWNORMAL);
|
||||
restartrequest = true;
|
||||
}
|
||||
PostQuitMessage (0);
|
||||
return TRUE;
|
||||
|
|
|
@ -3716,6 +3716,10 @@ int GameMain()
|
|||
DeleteStartupScreen();
|
||||
delete Args;
|
||||
Args = nullptr;
|
||||
#ifdef _WIN32
|
||||
void CheckForRestart();
|
||||
CheckForRestart();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue