From: Rémi Bernon rbernon@codeweavers.com
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 =