diff --git a/win32/luaconsole.cpp b/win32/luaconsole.cpp index 917da045..fc42946c 100644 --- a/win32/luaconsole.cpp +++ b/win32/luaconsole.cpp @@ -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 diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 4ee0cfc3..8701c142 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -3674,9 +3674,6 @@ int WINAPI WinMain( loop_exit: -#ifdef HAVE_LUA - StopAllLuaScripts(); -#endif CloseAllToolWindows(); Settings.StopEmulation = TRUE;