[PATCH v2 5/5] windows.media.speech: Assume that async_run_work cannot be NULL in IAsyncInfo_Close.
Rémi Bernon
wine at gitlab.winehq.org
Wed Apr 27 14:14:40 CDT 2022
From: Rémi Bernon <rbernon at codeweavers.com>
Unless it's closed already.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
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 =
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/5
More information about the wine-devel
mailing list