Prechádzať zdrojové kódy

2009-03-04 Jonathan Pobst <[email protected]>

	* ToolStripDropDown.cs: When dismissing control due to ESC, don't
	hit a NRE if we are a ContextMenuStrip and do not have a parent.
	[Fixes bug #478616]

svn path=/trunk/mcs/; revision=128573
Jonathan Pobst 17 rokov pred
rodič
commit
d04ef6e296

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

@@ -1,3 +1,9 @@
+2009-03-04  Jonathan Pobst  <[email protected]>
+
+	* ToolStripDropDown.cs: When dismissing control due to ESC, don't
+	hit a NRE if we are a ContextMenuStrip and do not have a parent.
+	[Fixes bug #478616]
+
 2009-03-01  Carlos Alberto Cortez <[email protected]>
 
 	* ListView.cs: When removing items from a ListViewItemCollection

+ 4 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDown.cs

@@ -940,6 +940,10 @@ namespace System.Windows.Forms
 				case Keys.Escape:
 					this.Dismiss (ToolStripDropDownCloseReason.Keyboard);
 					
+					// ContextMenuStrip won't have a parent
+					if (this.OwnerItem == null)
+						return true;
+						
 					ToolStrip parent_strip = this.OwnerItem.Parent;
 					ToolStripManager.SetActiveToolStrip (parent_strip, true);