Module: wine Branch: master Commit: 3276ab4aebb30c97af4e52bbf25299d86564c3d5 URL: https://source.winehq.org/git/wine.git/?a=commit;h=3276ab4aebb30c97af4e52bbf...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon Apr 25 17:26:57 2022 +0200
windows.media.speech: Assume that async_run_work cannot be NULL in IAsyncInfo_Close.
Unless it's closed already.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/windows.media.speech/async.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/dlls/windows.media.speech/async.c b/dlls/windows.media.speech/async.c index 418e903476e..64a095a0134 100644 --- a/dlls/windows.media.speech/async.c +++ b/dlls/windows.media.speech/async.c @@ -296,26 +296,22 @@ static HRESULT WINAPI async_operation_info_Cancel( IAsyncInfo *iface ) static HRESULT WINAPI async_operation_info_Close( IAsyncInfo *iface ) { struct async_operation *impl = impl_from_IAsyncInfo(iface); + HRESULT hr = S_OK;
TRACE("iface %p.\n", iface);
EnterCriticalSection(&impl->cs); if (impl->status == Started) - { - LeaveCriticalSection(&impl->cs); - return E_ILLEGAL_STATE_CHANGE; - } - - if (impl->async_run_work) + hr = E_ILLEGAL_STATE_CHANGE; + else if (impl->status != Closed) { CloseThreadpoolWork(impl->async_run_work); impl->async_run_work = NULL; + impl->status = Closed; } - - impl->status = Closed; LeaveCriticalSection(&impl->cs);
- return S_OK; + return hr; }
static const struct IAsyncInfoVtbl async_operation_info_vtbl =