From f61b52ccae9ade81c6b2b1e4bc6bd062c9182e59 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 7 Oct 2014 18:12:41 +1300 Subject: [PATCH] editor: Fix a benign loop-variable-inside-closure issue The getter is accessed exactly once, at call time. The setter is stored, and invoked later on losing focus, but we pass a bogus one anyway, so there is no issue. --- OpenRA.Editor/Form1.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index 6364e5dd2b..c9834e1c8d 100644 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -86,14 +86,17 @@ namespace OpenRA.Editor // TODO: make this work properly foreach (var init in Program.Rules.Actors[kv.Value.Type].GetInitKeys()) - apd.AddRow(init.First, + { + var initName = init.First; + apd.AddRow(initName, apd.MakeEditorControl(init.Second, () => { var nodesDict = objSaved.ToDictionary(); - return nodesDict.ContainsKey(init.First) ? nodesDict[init.First].Value : null; + return nodesDict.ContainsKey(initName) ? nodesDict[initName].Value : null; }, _ => { })); + } apd.ShowDialog();