From d7701deddc00dbe37b6891105d01588533eba991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 4 May 2022 19:32:14 +0200 Subject: [PATCH] windows.gaming.input: AddRef on the returned async handler in get_Completed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/windows.gaming.input/async.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/windows.gaming.input/async.c b/dlls/windows.gaming.input/async.c index 1426b3d8481..dfcb4144e74 100644 --- a/dlls/windows.gaming.input/async.c +++ b/dlls/windows.gaming.input/async.c @@ -146,7 +146,8 @@ static HRESULT WINAPI async_impl_get_Completed( IWineAsyncInfoImpl *iface, IWine EnterCriticalSection( &impl->cs ); if (impl->status == Closed) hr = E_ILLEGAL_METHOD_CALL; - *handler = (impl->handler != HANDLER_NOT_SET) ? impl->handler : NULL; + if (impl->handler == NULL || impl->handler == HANDLER_NOT_SET) *handler = NULL; + else IWineAsyncOperationCompletedHandler_AddRef( (*handler = impl->handler) ); LeaveCriticalSection( &impl->cs ); return hr;