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>
This commit is contained in:
Rémi Bernon 2022-04-25 17:26:57 +02:00 committed by Alexandre Julliard
parent 515899483e
commit 3276ab4aeb
1 changed files with 5 additions and 9 deletions

View File

@ -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 =