* Form.cs: Fix nullref when the window manager hasn't been created yet.
authorJackson Harper <jackson@novell.com>
Fri, 10 Mar 2006 23:51:24 +0000 (23:51 -0000)
committerJackson Harper <jackson@novell.com>
Fri, 10 Mar 2006 23:51:24 +0000 (23:51 -0000)
        * Control.cs: Fix nullref when we try to bring a control to the
        front that has no parent.

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs

index ef4aa78f56d1d35ef6e890f044dd9bbbff6ca43d..2484c0b4e5a6af9d1402f905e9b02100a6685e4f 100644 (file)
@@ -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  <jackson@ximian.com>
 
index 189f2a76d4dbd42e1c563d2c7f8f57d495cb7826..9ff0d21c5b5908e90811014c7297f51156f38928 100644 (file)
@@ -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);
index 7d745a02c19837617a90f45bc2d1dcd91cc9e565..56e43b9dd633a01212f9d00c2fe45c8309b486a0 100644 (file)
@@ -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;
                        }