2007-03-19 Chris Toshok <toshok@ximian.com>
authorChris Toshok <toshok@novell.com>
Mon, 19 Mar 2007 20:49:59 +0000 (20:49 -0000)
committerChris Toshok <toshok@novell.com>
Mon, 19 Mar 2007 20:49:59 +0000 (20:49 -0000)
[ Fixes #81773, and *seems* to fix #81553 as well ]

* XplatUIX11.cs: remove the assignment of hwnd.zombie = true from
AccumulateDestroyedHandles.  We need to do it *after* we send
WM_DESTROY, as the user's code can access Control.Handle in
OnHandleDestroyed, and this shouldn't cause a recreation.  Also,
move the WM_DESTROY/zombie handling to before the call to
XDestroyWindow.  For some reason without this ordering
FormTest.RecreateHandle hangs.  This ordering is semantically
equivalent, however, as XDestroyWindow is async anyway.

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

index a8fa5634bdb5ca0c19230c6f1a399672d6c2743b..9bf10cafca810bd9c301fd4f7484c232ad8935f1 100644 (file)
@@ -1,3 +1,16 @@
+2007-03-19  Chris Toshok  <toshok@ximian.com>
+
+       [ Fixes #81773, and *seems* to fix #81553 as well ]
+
+       * XplatUIX11.cs: remove the assignment of hwnd.zombie = true from
+       AccumulateDestroyedHandles.  We need to do it *after* we send
+       WM_DESTROY, as the user's code can access Control.Handle in
+       OnHandleDestroyed, and this shouldn't cause a recreation.  Also,
+       move the WM_DESTROY/zombie handling to before the call to
+       XDestroyWindow.  For some reason without this ordering
+       FormTest.RecreateHandle hangs.  This ordering is semantically
+       equivalent, however, as XDestroyWindow is async anyway.
+
 2007-03-19  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * RichTextBox.cs: Reset backcolor_set after setting default.
index fdde46dcf212c8657f0aaed6703567ec83806890..dd7ed99df99a5bdb9c7f9445a28d14726a79c925 100644 (file)
@@ -1720,7 +1720,6 @@ namespace System.Windows.Forms {
 
                                        list.Add (hwnd);
                                        CleanupCachedWindows (hwnd);
-                                       hwnd.zombie = true;
                                }
 
                                for (int  i = 0; i < controls.Length; i ++) {
@@ -2974,6 +2973,12 @@ namespace System.Windows.Forms {
 
                        AccumulateDestroyedHandles (Control.ControlNativeWindow.ControlFromHandle(hwnd.Handle), windows);
 
+
+                       foreach (Hwnd h in windows) {
+                               SendMessage (h.Handle, Msg.WM_DESTROY, IntPtr.Zero, IntPtr.Zero);
+                               h.zombie = true;
+                       }
+
                        lock (XlibLock) {
                                if (hwnd.whole_window != IntPtr.Zero) {
                                        #if DriverDebug || DriverDebugDestroy
@@ -2989,10 +2994,6 @@ namespace System.Windows.Forms {
                                }
 
                        }
-
-                       foreach (Hwnd h in windows) {
-                               SendMessage (h.Handle, Msg.WM_DESTROY, IntPtr.Zero, IntPtr.Zero);
-                       }
                }
 
                internal override IntPtr DispatchMessage(ref MSG msg) {