win32: fix a crash caused by WatcherThread. Lua Console must dispatch WM_DESTROY instead of WM_CLOSE.

This commit is contained in:
gocha 2012-08-21 22:21:38 +09:00
parent fd07444360
commit 1ba100fed0
2 changed files with 12 additions and 3 deletions

View File

@ -699,6 +699,10 @@ LRESULT CALLBACK LuaScriptProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
} break;
case WM_CLOSE:
DestroyWindow(hDlg);
return true;
case WM_DESTROY:
{
LuaPerWindowInfo& info = LuaWindowInfo[hDlg];
@ -820,4 +824,12 @@ const char* OpenLuaScript(const char* filename, const char* extraDirToCheck, boo
return NULL;
}
void CloseAllLuaWindows()
{
for (int i = 0; i < LuaScriptHWnds.size(); i++)
{
SendMessage(LuaScriptHWnds[i], WM_CLOSE, 0, 0);
}
}
#endif // HAVE_LUA

View File

@ -3674,9 +3674,6 @@ int WINAPI WinMain(
loop_exit:
#ifdef HAVE_LUA
StopAllLuaScripts();
#endif
CloseAllToolWindows();
Settings.StopEmulation = TRUE;