mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-01 14:41:33 +00:00
Fixed save-state on exit not working if there was a VM restart (eg. config h/w change). Fixes #564
This commit is contained in:
parent
140d505fe9
commit
898f30f08a
|
@ -1092,6 +1092,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
g_TimerIDEvent_100msec = 0;
|
||||
}
|
||||
LogFileOutput("WM_CLOSE (done)\n");
|
||||
// Exit via DefWindowProc(), which does the default action for WM_CLOSE, which is to call DestroyWindow(), posting WM_DESTROY
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
|
@ -1175,7 +1176,8 @@ LRESULT CALLBACK FrameWndProc (
|
|||
case WM_DESTROY:
|
||||
LogFileOutput("WM_DESTROY\n");
|
||||
DragAcceptFiles(window,0);
|
||||
Snapshot_Shutdown();
|
||||
if (!g_bRestart) // GH#564: Only save-state on shutdown (not on a restart)
|
||||
Snapshot_Shutdown();
|
||||
DebugDestroy();
|
||||
if (!g_bRestart) {
|
||||
DiskDestroy();
|
||||
|
|
|
@ -637,17 +637,19 @@ void Snapshot_Startup()
|
|||
|
||||
Snapshot_LoadState();
|
||||
|
||||
bDone = true;
|
||||
bDone = true; // Prevents a g_bRestart from loading an old save-state
|
||||
}
|
||||
|
||||
void Snapshot_Shutdown()
|
||||
{
|
||||
static bool bDone = false;
|
||||
|
||||
_ASSERT(!bDone);
|
||||
_ASSERT(!g_bRestart);
|
||||
if(!g_bSaveStateOnExit || bDone)
|
||||
return;
|
||||
|
||||
Snapshot_SaveState();
|
||||
|
||||
bDone = true;
|
||||
bDone = true; // Debug flag: should only be called once, and never on a g_bRestart
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user