Commit in reactos/subsys/win32k on MAIN
include/timer.h+11.4 -> 1.5
ntuser/timer.c+47-201.28 -> 1.29
      /window.c+4-11.204 -> 1.205
+52-21
3 modified files
Remove window timers when window is destroyed

reactos/subsys/win32k/include
timer.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- timer.h	18 Nov 2003 20:49:39 -0000	1.4
+++ timer.h	31 Mar 2004 18:37:11 -0000	1.5
@@ -11,6 +11,7 @@
 
 NTSTATUS FASTCALL InitTimerImpl(VOID);
 VOID FASTCALL RemoveTimersThread(HANDLE ThreadID);
+VOID FASTCALL RemoveTimersWindow(HWND hWnd);
 PMSG_TIMER_ENTRY FASTCALL IntRemoveTimer(HWND hWnd, UINT_PTR IDEvent, HANDLE ThreadID, BOOL SysTimer);
 UINT_PTR FASTCALL IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, BOOL SystemTimer);
 

reactos/subsys/win32k/ntuser
timer.c 1.28 -> 1.29
diff -u -r1.28 -r1.29
--- timer.c	29 Mar 2004 17:02:22 -0000	1.28
+++ timer.c	31 Mar 2004 18:37:12 -0000	1.29
@@ -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: timer.c,v 1.28 2004/03/29 17:02:22 navaraf Exp $
+/* $Id: timer.c,v 1.29 2004/03/31 18:37:12 gvg Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -61,10 +61,10 @@
 static CLIENT_ID     MsgTimerThreadId;
 
 
-#define IntLockTimerList \
+#define IntLockTimerList() \
   ExAcquireFastMutex(&Mutex)
 
-#define IntUnLockTimerList \
+#define IntUnLockTimerList() \
   ExReleaseFastMutex(&Mutex)
 
 /* FUNCTIONS *****************************************************************/
@@ -123,7 +123,7 @@
   PMSG_TIMER_ENTRY MsgTimer;
   PLIST_ENTRY EnumEntry;
   
-  IntLockTimerList;
+  IntLockTimerList();
   
   EnumEntry = TimerListHead.Flink;
   while (EnumEntry != &TimerListHead)
@@ -143,7 +143,35 @@
     }
   }
   
-  IntUnLockTimerList;
+  IntUnLockTimerList();
+}
+
+
+/* 
+ * NOTE: It doesn't kill the timer. It just removes them from the list.
+ */
+VOID FASTCALL
+RemoveTimersWindow(HWND Wnd)
+{
+  PMSG_TIMER_ENTRY MsgTimer;
+  PLIST_ENTRY EnumEntry;
+
+  IntLockTimerList();
+  
+  EnumEntry = TimerListHead.Flink;
+  while (EnumEntry != &TimerListHead)
+  {
+    MsgTimer = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
+    EnumEntry = EnumEntry->Flink;
+    
+    if (MsgTimer->Msg.hwnd == Wnd)
+    {
+      RemoveEntryList(&MsgTimer->ListEntry);
+      ExFreePool(MsgTimer);
+    }
+  }
+  
+  IntUnLockTimerList();
 }
 
 
@@ -157,10 +185,10 @@
   PWINDOW_OBJECT WindowObject;
   HANDLE ThreadID;
   UINT_PTR Ret = 0;
-  
+ 
   ThreadID = PsGetCurrentThreadId();
   KeQuerySystemTime(&CurrentTime);
-  IntLockTimerList;
+  IntLockTimerList();
   
   if((hWnd == NULL) && !SystemTimer)
   {
@@ -169,7 +197,7 @@
     
     if(Index == (ULONG) -1)
     {
-      IntUnLockTimerList;
+      IntUnLockTimerList();
       return 0;
     }
     
@@ -180,14 +208,14 @@
     WindowObject = IntGetWindowObject(hWnd);
     if(!WindowObject)
     {
-      IntUnLockTimerList;
+      IntUnLockTimerList();
       SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
       return 0;
     }
     
     if(WindowObject->OwnerThread != PsGetCurrentThread())
     {
-      IntUnLockTimerList;
+      IntUnLockTimerList();
       IntReleaseWindowObject(WindowObject);
       SetLastWin32Error(ERROR_ACCESS_DENIED);
       return 0;
@@ -231,7 +259,7 @@
     NewTimer = ExAllocatePoolWithTag(PagedPool, sizeof(MSG_TIMER_ENTRY), TAG_TIMER);
     if(!NewTimer)
     {
-      IntUnLockTimerList;
+      IntUnLockTimerList();
       SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
       return 0;
     }
@@ -253,7 +281,7 @@
      KeSetTimer(&Timer, NewTimer->Timeout, NULL);
   }
 
-  IntUnLockTimerList;
+  IntUnLockTimerList();
 
   return Ret;
 }
@@ -265,14 +293,14 @@
   PMSG_TIMER_ENTRY MsgTimer;
   PWINDOW_OBJECT WindowObject;
   
-  IntLockTimerList;
+  IntLockTimerList();
   
   /* window-less timer? */
   if((hWnd == NULL) && !SystemTimer)
   {
     if(!RtlAreBitsSet(&WindowLessTimersBitMap, uIDEvent - 1, 1))
     {
-      IntUnLockTimerList;
+      IntUnLockTimerList();
       /* bit was not set */
       /* FIXME: set the last error */
       return FALSE;
@@ -285,13 +313,13 @@
     WindowObject = IntGetWindowObject(hWnd);
     if(!WindowObject)
     {
-      IntUnLockTimerList; 
+      IntUnLockTimerList(); 
       SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
       return FALSE;
     }
     if(WindowObject->OwnerThread != PsGetCurrentThread())
     {
-      IntUnLockTimerList;
+      IntUnLockTimerList();
       IntReleaseWindowObject(WindowObject);
       SetLastWin32Error(ERROR_ACCESS_DENIED);
       return FALSE;
@@ -301,7 +329,7 @@
   
   MsgTimer = IntRemoveTimer(hWnd, uIDEvent, PsGetCurrentThreadId(), SystemTimer);
   
-  IntUnLockTimerList;
+  IntUnLockTimerList();
   
   if(MsgTimer == NULL)
   {
@@ -316,7 +344,6 @@
   return TRUE;
 }
 
-extern VOID STDCALL ValidateNonPagedPool(VOID);
 static VOID STDCALL
 TimerThreadMain(PVOID StartContext)
 {
@@ -343,7 +370,7 @@
     
     ThreadsToDereferenceCount = ThreadsToDereferencePos = 0;
     
-    IntLockTimerList;
+    IntLockTimerList();
     
     KeQuerySystemTime(&CurrentTime);
 
@@ -412,7 +439,7 @@
       KeSetTimer(&Timer, MsgTimer->Timeout, NULL);
     }
     
-    IntUnLockTimerList;
+    IntUnLockTimerList();
 
     for (i = 0; i < ThreadsToDereferencePos; i++)
        ObDereferenceObject(ThreadsToDereference[i]);

reactos/subsys/win32k/ntuser
window.c 1.204 -> 1.205
diff -u -r1.204 -r1.205
--- window.c	30 Mar 2004 22:49:38 -0000	1.204
+++ window.c	31 Mar 2004 18:37:12 -0000	1.205
@@ -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.204 2004/03/30 22:49:38 gvg Exp $
+/* $Id: window.c,v 1.205 2004/03/31 18:37:12 gvg Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -53,6 +53,7 @@
 #include <include/hook.h>
 #include <include/useratom.h>
 #include <include/tags.h>
+#include <include/timer.h>
 
 #define NDEBUG
 #include <win32k/debug1.h>
@@ -292,6 +293,8 @@
   BOOL BelongsToThreadData;
   
   ASSERT(Window);
+
+  RemoveTimersWindow(Window->Self);
   
   IntLockThreadWindows(Window->OwnerThread->Win32Thread);
   if(Window->Status & WINDOWSTATUS_DESTROYING)
CVSspam 0.2.8