Clean up restarting: close the mutex to make sure it actually restarts,
and don't make assumptions about the executable filename.
This commit is contained in:
+11
-1
@@ -34,6 +34,9 @@
|
||||
// #include "RageUtil.h" // for GotoURL
|
||||
HINSTANCE GotoURL(const char *url);
|
||||
|
||||
/* in StepMania.cpp */
|
||||
void CleanupForRestart();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define CODE_WINDOW (256)
|
||||
@@ -1445,9 +1448,16 @@ BOOL APIENTRY CrashDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
return TRUE;
|
||||
case IDC_BUTTON_RESTART:
|
||||
{
|
||||
/* Clear the startup mutex, since we're starting a new
|
||||
* instance before ending ourself. */
|
||||
CleanupForRestart();
|
||||
|
||||
char cwd[MAX_PATH];
|
||||
SpliceProgramPath(cwd, MAX_PATH, "");
|
||||
|
||||
TCHAR szFullAppPath[MAX_PATH];
|
||||
GetModuleFileName(NULL, szFullAppPath, MAX_PATH);
|
||||
|
||||
// Launch StepMania
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
@@ -1455,7 +1465,7 @@ BOOL APIENTRY CrashDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
|
||||
CreateProcess(
|
||||
NULL, // pointer to name of executable module
|
||||
"stepmania.exe", // pointer to command line string
|
||||
szFullAppPath, // pointer to command line string
|
||||
NULL, // process security attributes
|
||||
NULL, // thread security attributes
|
||||
false, // handle inheritance flag
|
||||
|
||||
@@ -378,6 +378,11 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR CmdLine, int nCmdShow
|
||||
return 0L;
|
||||
}
|
||||
|
||||
void CleanupForRestart()
|
||||
{
|
||||
CloseHandle( g_hMutex );
|
||||
g_hMutex = NULL;
|
||||
}
|
||||
|
||||
void CreateLoadingWindow()
|
||||
{
|
||||
@@ -502,6 +507,13 @@ BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
break;
|
||||
case IDC_BUTTON_RESTART:
|
||||
{
|
||||
/* Clear the startup mutex, since we're starting a new
|
||||
* instance before ending ourself. */
|
||||
CleanupForRestart();
|
||||
|
||||
TCHAR szFullAppPath[MAX_PATH];
|
||||
GetModuleFileName(NULL, szFullAppPath, MAX_PATH);
|
||||
|
||||
// Launch StepMania
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
@@ -509,7 +521,7 @@ BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
|
||||
CreateProcess(
|
||||
NULL, // pointer to name of executable module
|
||||
"stepmania.exe", // pointer to command line string
|
||||
szFullAppPath, // pointer to command line string
|
||||
NULL, // process security attributes
|
||||
NULL, // thread security attributes
|
||||
false, // handle inheritance flag
|
||||
|
||||
Reference in New Issue
Block a user