ram watch: watches are deleted by index

If you have two watches with an identical address, deleting one will always delete the first one. This commit fixes that
This commit is contained in:
scrimpeh 2020-06-22 20:47:22 +02:00 committed by adelikat
parent c13430896f
commit d6994ea1af
1 changed files with 6 additions and 5 deletions

View File

@ -741,14 +741,15 @@ namespace BizHawk.Client.EmuHawk
private void RemoveWatchMenuItem_Click(object sender, EventArgs e)
{
var items = SelectedItems.ToList();
if (items.Any())
var indices = SelectedIndices
.OrderByDescending(i => i)
.ToList();
if (indices.Any())
{
foreach (var item in items)
foreach (var index in indices)
{
_watches.Remove(item);
_watches.RemoveAt(index);
}
WatchListView.RowCount = _watches.Count;
GeneralUpdate();
UpdateWatchCount();