Andrew Eikum : wineoss.drv: Fix DeleteTimerQueueTimer usage.
Module: wine Branch: master Commit: 7437eb63fc2801ceeca0cf072aea58bd5571c99b URL: http://source.winehq.org/git/wine.git/?a=commit;h=7437eb63fc2801ceeca0cf072a... Author: Andrew Eikum <aeikum(a)codeweavers.com> Date: Thu Feb 23 09:44:20 2012 -0600 wineoss.drv: Fix DeleteTimerQueueTimer usage. --- dlls/wineoss.drv/mmdevdrv.c | 30 +++++++++++++++++++----------- 1 files changed, 19 insertions(+), 11 deletions(-) diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 5f8c4ac..8658348 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -1335,13 +1335,15 @@ static void CALLBACK oss_period_callback(void *user, BOOLEAN timer) EnterCriticalSection(&This->lock); - if(This->dataflow == eRender && This->held_frames) - oss_write_data(This); - else if(This->dataflow == eCapture) - oss_read_data(This); + if(This->playing){ + if(This->dataflow == eRender && This->held_frames) + oss_write_data(This); + else if(This->dataflow == eCapture) + oss_read_data(This); - if(This->event) - SetEvent(This->event); + if(This->event) + SetEvent(This->event); + } LeaveCriticalSection(&This->lock); } @@ -1384,6 +1386,8 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient *iface) static HRESULT WINAPI AudioClient_Stop(IAudioClient *iface) { ACImpl *This = impl_from_IAudioClient(iface); + HANDLE event; + DWORD wait; TRACE("(%p)\n", This); @@ -1399,16 +1403,20 @@ static HRESULT WINAPI AudioClient_Stop(IAudioClient *iface) return S_FALSE; } - if(This->timer && This->timer != INVALID_HANDLE_VALUE){ - DeleteTimerQueueTimer(g_timer_q, This->timer, - INVALID_HANDLE_VALUE); - This->timer = NULL; - } + event = CreateEventW(NULL, TRUE, FALSE, NULL); + wait = !DeleteTimerQueueTimer(g_timer_q, This->timer, event); + if(wait) + WARN("DeleteTimerQueueTimer error %u\n", GetLastError()); + wait = wait && GetLastError() == ERROR_IO_PENDING; This->playing = FALSE; LeaveCriticalSection(&This->lock); + if(event && wait) + WaitForSingleObject(event, INFINITE); + CloseHandle(event); + return S_OK; }
participants (1)
-
Alexandre Julliard