[SWF] Allow to compile without X11 installed (Xamarin-59496)
authorEberhard Beilharz <eb1@sil.org>
Thu, 14 Sep 2017 15:52:52 +0000 (17:52 +0200)
committerMarek Safar <marek.safar@gmail.com>
Fri, 15 Sep 2017 08:33:22 +0000 (10:33 +0200)
This change fixes a crash we get in resgen when building without
X11 installed. The bug got introduced when fixing Xamarin-395.

Change-Id: If81a4a3ca4db7a1b0156480ad49bd61610ecebf0

mcs/class/System.Windows.Forms/System.Windows.Forms.Layout/TableLayoutSettingsTypeConverter.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/TableLayoutStyleCollection.cs

index 575c0fe753e93b495544fca17d481f0b17195325..b4e90d4c43af79171e8c4bd7e3295d42dfc00c6f 100644 (file)
@@ -118,7 +118,7 @@ namespace System.Windows.Forms.Layout
 \r
                        XmlDocument xmldoc = new XmlDocument();\r
                        xmldoc.LoadXml (value as string);\r
-                       TableLayoutSettings settings = new TableLayoutSettings(new TableLayoutPanel());\r
+                       TableLayoutSettings settings = new TableLayoutSettings(null);
                        int count = ParseControl (xmldoc, settings);\r
                        ParseColumnStyle (xmldoc, settings);\r
                        ParseRowStyle (xmldoc, settings);\r
index 090ba92ecf7adafc75b7a0bed0ff14e87293dda3..df0558da9331360d69c3d81fbb4916ecba6a796d 100644 (file)
@@ -38,9 +38,6 @@ namespace System.Windows.Forms {
                
                internal TableLayoutStyleCollection (TableLayoutPanel table)
                {
-                       if (table == null)
-                               throw new ArgumentNullException("table");
-                       
                        this.table = table;
                }
                
@@ -54,7 +51,8 @@ namespace System.Windows.Forms {
                        foreach (TableLayoutStyle style in al)
                                style.Owner = null;
                        al.Clear ();
-                       table.PerformLayout ();
+                       if (table != null)
+                               table.PerformLayout ();
                }
                
                public int Count {
@@ -65,7 +63,8 @@ namespace System.Windows.Forms {
                {
                        ((TableLayoutStyle)al[index]).Owner = null;
                        al.RemoveAt (index);
-                       table.PerformLayout ();
+                       if (table != null)
+                               table.PerformLayout ();
                }
                
 #region IList methods
@@ -103,14 +102,16 @@ namespace System.Windows.Forms {
                                throw new ArgumentException ("Style is already owned");
                        ((TableLayoutStyle)style).Owner = table;
                        al.Insert (index, (TableLayoutStyle) style);
-                       table.PerformLayout ();
+                       if (table != null)
+                               table.PerformLayout ();
                }
 
                void IList.Remove (object style)
                {
                        ((TableLayoutStyle)style).Owner = null;
                        al.Remove ((TableLayoutStyle) style);
-                       table.PerformLayout ();
+                       if (table != null)
+                               table.PerformLayout ();
                }
 
                bool IList.IsFixedSize {
@@ -134,7 +135,8 @@ namespace System.Windows.Forms {
                                        throw new ArgumentException ("Style is already owned");
                                ((TableLayoutStyle)value).Owner = table;
                                al [index] = value;
-                               table.PerformLayout ();
+                               if (table != null)
+                                       table.PerformLayout ();
                        }
                }
 #endregion