Author: rolf
Date: 2007-07-13 07:51:54 -0400 (Fri, 13 Jul 2007)
New Revision: 81938

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs
Log:
* Control.cs: Don't do anything in WmShowWindow if the control has been
  disposed. We can get WM_SHOWWINDOW after a control is disposed: a
  control is created, put on a form, the control is disposed (the
  form is never shown), and then we get a MapNotify, triggering a
  WM_SHOWWINDOW.
* Form.cs: Exclude the current form when sending Deactivate to all
  MdiChildren.
* NativeWindow.cs: Set WindowCreating to null as soon as possible,
  there was a race condition because assigning the handle raises
  events, we can get more messages, therefore trying to assign the
  handle again, which would fail if any of those event handlers
  closed/disposed the control.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-07-13 10:34:43 UTC (rev 81937)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-07-13 11:51:54 UTC (rev 81938)
@@ -1,5 +1,20 @@
 2007-07-13  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
 
+       * Control.cs: Don't do anything in WmShowWindow if the control has been
+         disposed. We can get WM_SHOWWINDOW after a control is disposed: a
+         control is created, put on a form, the control is disposed (the
+         form is never shown), and then we get a MapNotify, triggering a
+         WM_SHOWWINDOW.
+       * Form.cs: Exclude the current form when sending Deactivate to all
+         MdiChildren.
+       * NativeWindow.cs: Set WindowCreating to null as soon as possible,
+         there was a race condition because assigning the handle raises
+         events, we can get more messages, therefore trying to assign the
+         handle again, which would fail if any of those event handlers
+         closed/disposed the control.
+
+2007-07-13  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
+
        * Form.cs: Make the fix for #80775 windows-only (fixes #81957).
 
 2007-07-12  Jonathan Pobst  <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-07-13 10:34:43 UTC (rev 81937)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-07-13 11:51:54 UTC (rev 81938)
@@ -5328,6 +5328,9 @@
                }
 
                private void WmShowWindow (ref Message m) {
+                       if (IsDisposed)
+                               return;
+                                               
                        if (m.WParam.ToInt32() != 0) {
                                if (m.LParam.ToInt32 () == 0) {
                                        CreateControl ();

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2007-07-13 10:34:43 UTC (rev 81937)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2007-07-13 11:51:54 UTC (rev 81938)
@@ -1871,7 +1871,7 @@
                                        if (MdiParent != null) {
                                                foreach (Form form in 
MdiParent.MdiChildren) {
                                                        wm = 
form.window_manager as MdiWindowManager;
-                                                       if (wm != null) {
+                                                       if (wm != null && form 
!= this) {
                                                                // This will 
only raise deactivate once, and only if activate has
                                                                // already been 
raised.
                                                                
wm.RaiseDeactivate ();

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs  
2007-07-13 10:34:43 UTC (rev 81937)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs  
2007-07-13 11:51:54 UTC (rev 81938)
@@ -187,10 +187,12 @@
                                        // WndProc, install their own WM_CREATE 
block, and look at
                                        // this.Handle, and it needs to be set. 
 Otherwise, we end up
                                        // recursively creating windows and 
emitting WM_CREATE.
-                                       if (WindowCreating.window_handle == 
IntPtr.Zero)
-                                               WindowCreating.AssignHandle 
(hWnd);
+                                       window = WindowCreating;
+                                       WindowCreating = null;
+                                       if (window.window_handle == IntPtr.Zero)
+                                               window.AssignHandle (hWnd);
 
-                                       WindowCreating.WndProc (ref m);
+                                       window.WndProc (ref m);
                                }
                                else
                                        m.Result=XplatUI.DefWndProc(ref m);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to