Przeglądaj źródła

2009-05-10 Carlos Alberto Cortez <[email protected]>

	* Control.cs: When assigning ContextMenu, do a null check before
	assigning its container field.


svn path=/trunk/mcs/; revision=133865
Carlos Alberto Cortez 16 lat temu
rodzic
commit
8a352fe7f6

+ 5 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,8 @@
+2009-05-10  Carlos Alberto Cortez <[email protected]>
+
+	* Control.cs: When assigning ContextMenu, do a null check before
+	assigning its container field.
+
 2009-05-08  Brad Taylor  <[email protected]>
 
 	* DateTimePicker.cs: Add a UIA-specific property to ensure that if

+ 2 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs

@@ -2590,7 +2590,8 @@ namespace System.Windows.Forms
 			set { 
 				if (this.context_menu_strip != value) {
 					this.context_menu_strip = value;
-					value.container = this;
+					if (value != null)
+						value.container = this;
 					OnContextMenuStripChanged (EventArgs.Empty);
 				}
 			}