Clean up old LuaImp before creating new one

Prevents memory/resource leak

Causes open forms to be closed on core restart
This commit is contained in:
kalimag 2022-11-27 19:54:06 +01:00 committed by James Groom
parent 3a70fb65f8
commit ee66faba0b
1 changed files with 1 additions and 0 deletions

View File

@ -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,