From ee66faba0bc118331f50cae6f9a886727a077199 Mon Sep 17 00:00:00 2001 From: kalimag Date: Sun, 27 Nov 2022 19:54:06 +0100 Subject: [PATCH] Clean up old LuaImp before creating new one Prevents memory/resource leak Causes open forms to be closed on core restart --- src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index 38058cc475..fc70a91f8a 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -209,6 +209,7 @@ namespace BizHawk.Client.EmuHawk LuaFileList newScripts = new(LuaImp?.ScriptList, onChanged: SessionChangedCallback); LuaFunctionList registeredFuncList = new(onChanged: UpdateRegisteredFunctionsDialog); + (LuaImp as Win32LuaLibraries)?.Close(); LuaImp = new Win32LuaLibraries( newScripts, registeredFuncList,