Pārlūkot izejas kodu

* Form.cs: Fix nullref when the window manager hasn't been created yet.
* Control.cs: Fix nullref when we try to bring a control to the
front that has no parent.


svn path=/trunk/mcs/; revision=57803

Jackson Harper 20 gadi atpakaļ
vecāks
revīzija
442b05a789

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

@@ -2,11 +2,15 @@
 
 	* Form.cs: We need to use the ActiveMenu when calculating menu
 	height.
+	- Fix nullref when the window manager hasn't been created yet.
+	* Control.cs: Fix nullref when we try to bring a control to the
+	front that has no parent.
 	* MdiWindowManager.cs: Use the MaximizedMenu for calculating
 	height.
 	- Add a dummy item to the maximized menu so it always has the
 	correct height. Otherwise when there are no menus we don't get our
 	icon and buttons.
+	
 
 2006-03-10  Jackson Harper  <[email protected]>
 

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

@@ -2515,7 +2515,7 @@ namespace System.Windows.Forms
 				if (parent.child_controls.Contains(this)) {
 					parent.child_controls.SetChildIndex(this, 0);
 				}
-			} else {
+			} else if (parent != null) {
 				if (parent.child_controls.impl_list != null) {
 					Control last_impl = (Control) parent.child_controls.impl_list [parent.child_controls.impl_list.Count - 1];
 					XplatUI.SetZOrder (this.window.Handle, last_impl.Handle, false, false);

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

@@ -604,7 +604,7 @@ namespace System.Windows.Forms {
 				Form child = ActiveMdiChild;
 				if (child == null)
 					return null;
-				if (child.WindowManager.GetWindowState () != FormWindowState.Maximized)
+				if (child.WindowManager == null || child.window_state != FormWindowState.Maximized)
 					return null;
 				return (MdiWindowManager) child.WindowManager;
 			}