From 16d6d70376916f0e8ef9f88d11425bd5573d537a Mon Sep 17 00:00:00 2001 From: Sour Date: Wed, 26 Feb 2025 20:38:46 +0900 Subject: [PATCH] Debugger: Fixed bug that copied watch entries from rom to rom While the debugger was active and the current rom had watch entries, opening a new rom for the same console that had never been opened in the debugger would end up copying the watch entries from the previous rom into the new rom's workspace --- UI/Debugger/Utilities/DebugWorkspaceManager.cs | 2 ++ UI/Debugger/WatchManager.cs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/UI/Debugger/Utilities/DebugWorkspaceManager.cs b/UI/Debugger/Utilities/DebugWorkspaceManager.cs index bfe22765..b20f9c66 100644 --- a/UI/Debugger/Utilities/DebugWorkspaceManager.cs +++ b/UI/Debugger/Utilities/DebugWorkspaceManager.cs @@ -282,6 +282,8 @@ namespace Mesen.Debugger.Utilities LabelManager.ResetLabels(); BreakpointManager.ClearBreakpoints(); + WatchManager.ClearEntries(); + if(dbgWorkspace.WorkspaceByCpu.Count == 0) { DefaultLabelHelper.SetDefaultLabels(); } else { diff --git a/UI/Debugger/WatchManager.cs b/UI/Debugger/WatchManager.cs index 849afb08..eb92882b 100644 --- a/UI/Debugger/WatchManager.cs +++ b/UI/Debugger/WatchManager.cs @@ -37,6 +37,13 @@ namespace Mesen.Debugger return manager; } + public static void ClearEntries() + { + foreach(WatchManager wm in _watchManagers.Values) { + wm.WatchEntries = new(); + } + } + public WatchManager(CpuType cpuType) { _cpuType = cpuType;