[WIN32K]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Sat, 1 May 2010 09:55:16 +0000 (09:55 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Sat, 1 May 2010 09:55:16 +0000 (09:55 +0000)
<bug>
- The timer implementation uses a bitmap to store window-less timers. As an optimization to find the first free index, it uses the variable "HintIndex" which points to the first timer index. In order to find the next free index, the RtlFindClearBitsAndSet function is used. When a new timer is allocated, the "HintIndex" variable is increased, which increases the search offset. Now if more than NUM_WINDOW_LESS_TIMERS (1024) timers are allocated, no more timers can be allocated because RtlFindClearBitsAndSet will claim no more index are available, because the free indexes are below the search offset.
</bug>
<fix>
Everytime a timer gets freed, store the freed index in "HintIndex". As a result the timer implementation will always find a free timer index (when there is one)
</fix>

svn path=/trunk/; revision=47069

reactos/subsystems/win32/win32k/ntuser/timer.c

index 863987f..a1da2d6 100644 (file)
@@ -526,6 +526,8 @@ IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
       ASSERT(RtlAreBitsSet(&WindowLessTimersBitMap, IDEvent - 1, 1));
       RtlClearBits(&WindowLessTimersBitMap, IDEvent - 1, 1);
 
       ASSERT(RtlAreBitsSet(&WindowLessTimersBitMap, IDEvent - 1, 1));
       RtlClearBits(&WindowLessTimersBitMap, IDEvent - 1, 1);
 
+      HintIndex = IDEvent - 1;
+
       IntUnlockWindowlessTimerBitmap();
    }
 
       IntUnlockWindowlessTimerBitmap();
    }