[System.Xml.Linq] Fix XNamespace.GetName locking to not be racy. Fixes #18564.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 25 Mar 2014 12:47:42 +0000 (08:47 -0400)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 25 Mar 2014 12:50:46 +0000 (08:50 -0400)
mcs/class/System.Xml.Linq/System.Xml.Linq/XNamespace.cs

index 6b953e6abd7830de60449a6715d04277b5be1973..1cd466006774d0c26a837e5c915ae44235335d93 100644 (file)
@@ -72,9 +72,10 @@ namespace System.Xml.Linq
 
                public XName GetName (string localName)
                {
-                       if (table == null)
-                               table = new Dictionary<string, XName> ();
-                       lock (table) {
+                       lock (nstable) {
+                               if (table == null)
+                                       table = new Dictionary<string, XName> ();
+
                                XName ret;
                                if (!table.TryGetValue (localName, out ret)) {
                                        ret = new XName (localName, this);