Commit in reactos/subsys/win32k/ntuser on MAIN
window.c+23-231.256 -> 1.257
revert some of the changes i did to IntDestroyWindow()

reactos/subsys/win32k/ntuser
window.c 1.256 -> 1.257
diff -u -r1.256 -r1.257
--- window.c	12 Dec 2004 23:42:35 -0000	1.256
+++ window.c	13 Dec 2004 00:11:59 -0000	1.257
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: window.c,v 1.256 2004/12/12 23:42:35 weiden Exp $
+/* $Id: window.c,v 1.257 2004/12/13 00:11:59 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -284,17 +284,6 @@
      in IntDestroyWindow() */
   RemoveEntryList(&Window->ThreadListEntry);
   IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
-
-  if (Window->UpdateRegion != NULL ||
-      Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
-  {
-     MsqDecPaintCountQueue(Window->MessageQueue);
-  }
-
-  if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
-  {
-     MsqDecPaintCountQueue(Window->MessageQueue);
-  }
   
   BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
   
@@ -302,18 +291,7 @@
   {
     /* Send destroy messages */
     IntSendDestroyMsg(Window->Self);
-    if(BelongsToThreadData)
-      IntSendMessage(Window->Self, WM_NCDESTROY, 0, 0);
   }
-  
-  /* from now on no messages can be sent to this window anymore */
-  IntLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
-  Window->Status |= WINDOWSTATUS_DESTROYED;
-  /* don't remove the WINDOWSTATUS_DESTROYING bit */
-  IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
-  
-  /* flush the message queue */
-  MsqRemoveWindowMessagesFromQueue(Window);
 
   /* free child windows */
   Children = IntWinListChildren(Window);
@@ -336,6 +314,28 @@
       ExFreePool(Children);
     }
 
+  if(SendMessages)
+  {
+    /*
+     * Clear the update region to make sure no WM_PAINT messages will be
+     * generated for this window while processing the WM_NCDESTROY.
+     */
+    IntRedrawWindow(Window, NULL, 0,
+                    RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE |
+                    RDW_NOINTERNALPAINT | RDW_NOCHILDREN);
+    if(BelongsToThreadData)
+      IntSendMessage(Window->Self, WM_NCDESTROY, 0, 0);
+  }
+  
+  /* flush the message queue */
+  MsqRemoveWindowMessagesFromQueue(Window);
+  
+  /* from now on no messages can be sent to this window anymore */
+  IntLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
+  Window->Status |= WINDOWSTATUS_DESTROYED;
+  /* don't remove the WINDOWSTATUS_DESTROYING bit */
+  IntUnLockThreadWindows(Window->OwnerThread->Tcb.Win32Thread);
+
   /* reset shell window handles */
   if(ThreadData->Desktop)
   {
CVSspam 0.2.8