From 877d81b0fffe781bc2f6c5283e61bbbf17b37d53 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 1 Mar 2014 19:16:17 +0000 Subject: [PATCH] Fix bug where adding to Ram Watch from another dialog while it has changes and autoload is on was asking you to save changes before adding an address --- BizHawk.Client.EmuHawk/tools/ToolManager.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs index 9902c73b8e..8ebc7151e9 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -38,6 +38,20 @@ namespace BizHawk.Client.EmuHawk return result; } + /// + /// Determines whether a given IToolForm is already loaded + /// + public bool IsLoaded() where T : IToolForm + { + var existingTool = _tools.FirstOrDefault(x => x is T); + if (existingTool != null) + { + return !existingTool.IsDisposed; + } + + return false; + } + /// /// Returns true if an instance of T exists /// @@ -407,7 +421,7 @@ namespace BizHawk.Client.EmuHawk public void LoadRamWatch(bool loadDialog) { - if (Global.Config.RecentWatches.AutoLoad && !Global.Config.RecentWatches.Empty) + if (!IsLoaded() && Global.Config.RecentWatches.AutoLoad && !Global.Config.RecentWatches.Empty) { GlobalWin.Tools.RamWatch.LoadFileFromRecent(Global.Config.RecentWatches[0]); }