uiTimer() Ensure Windows timer IDs are unique

This commit is contained in:
cody271 2017-08-21 13:04:13 -07:00
parent b1210165a0
commit 4e6adca08c
1 changed files with 2 additions and 0 deletions

View File

@ -133,6 +133,8 @@ void uiQueueMain(void (*f)(void *data), void *data)
void uiTimer(int milliseconds, int (*f)(void *data), void *data)
{
UINT_PTR id = timerHandlers.size() + 1;
while (timerHandlers.find(id) != timerHandlers.end())
id++;
if (SetTimer(utilWindow, id, milliseconds, NULL) == 0)
logLastError(L"SetTimer()");
timerHandlers[id] = TimerHandler(f, data);