Piotr Caban : winmm: Destroy timer after calling callback.
Module: wine Branch: master Commit: daec24a9d6adc25954a239a588f4019acd79609a URL: https://source.winehq.org/git/wine.git/?a=commit;h=daec24a9d6adc25954a239a58... Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Sep 30 14:37:57 2020 +0200 winmm: Destroy timer after calling callback. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winmm/time.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/dlls/winmm/time.c b/dlls/winmm/time.c index 2d5f3db389..634b5df792 100644 --- a/dlls/winmm/time.c +++ b/dlls/winmm/time.c @@ -107,7 +107,7 @@ static CONDITION_VARIABLE TIME_cv; */ static int TIME_MMSysTimeCallback(void) { - WINE_TIMERENTRY *timer, copy; + WINE_TIMERENTRY *timer; int i, delta_time; /* since timeSetEvent() and timeKillEvent() can be called @@ -139,15 +139,7 @@ static int TIME_MMSysTimeCallback(void) if (delta_time > 0) break; if (timer->wFlags & TIME_PERIODIC) - { timer->dwTriggerTime += timer->wDelay; - } - else - { - copy = *timer; - timer->wTimerID = 0; - timer = © - } switch(timer->wFlags & (TIME_CALLBACK_EVENT_SET|TIME_CALLBACK_EVENT_PULSE)) { @@ -171,9 +163,12 @@ static int TIME_MMSysTimeCallback(void) EnterCriticalSection(&WINMM_cs); if (flags & TIME_KILL_SYNCHRONOUS) LeaveCriticalSection(&TIME_cbcrst); + if (id != timer->wTimerID) timer = NULL; } break; } + if (timer && !(timer->wFlags & TIME_PERIODIC)) + timer->wTimerID = 0; } return delta_time; }
participants (1)
-
Alexandre Julliard