Debugger: Always remove identical labels before adding a new one

This commit is contained in:
Sour 2018-07-26 20:54:44 -04:00
parent 7e3da8d1bf
commit 9120ac35a9

View file

@ -99,6 +99,12 @@ namespace Mesen.GUI.Debugger
public static bool SetLabel(UInt32 address, AddressType type, string label, string comment, bool raiseEvent = true)
{
if(_reverseLookup.ContainsKey(label)) {
//Another identical label exists, we need to remove it
CodeLabel existingLabel = _reverseLookup[label];
DeleteLabel(existingLabel.Address, existingLabel.AddressType, false);
}
string key = GetKey(address, type);
if(_labels.ContainsKey(key)) {
_reverseLookup.Remove(_labels[key].Label);