InputRoll - when RowCount changes, deselect rows that may no longer exist, fixes crash on Lua Console when removing lua scripts (and lots of other bugs most likely)

This commit is contained in:
adelikat 2019-11-17 09:26:18 -06:00
parent a2ed0361c4
commit 901e9f2ceb
2 changed files with 3 additions and 7 deletions

View File

@ -250,6 +250,7 @@ namespace BizHawk.Client.EmuHawk
set
{
_rowCount = value;
_selectedItems.RemoveWhere(i => i.RowIndex >= _rowCount);
Invalidate();
RecalculateScrollBars();
}

View File

@ -139,7 +139,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!Global.Config.RecentLua.Empty)
{
LoadLuaFromRecent(Global.Config.RecentLua.MostRecent);
LoadLuaFile(Global.Config.RecentLua.MostRecent);
}
}
@ -472,11 +472,6 @@ namespace BizHawk.Client.EmuHawk
NumberOfScripts.Text = message;
}
private void LoadLuaFromRecent(string path)
{
LoadLuaFile(path);
}
private bool LuaAlreadyInSession(string path)
{
return LuaImp.ScriptList.Any(t => path == t.Path);
@ -736,7 +731,7 @@ namespace BizHawk.Client.EmuHawk
{
RecentScriptsSubMenu.DropDownItems.Clear();
RecentScriptsSubMenu.DropDownItems.AddRange(
Global.Config.RecentLua.RecentMenu(LoadLuaFromRecent, true));
Global.Config.RecentLua.RecentMenu(LoadLuaFile, true));
}
private void NewSessionMenuItem_Click(object sender, EventArgs e)