diff --git a/src/corelib/kernel/qfunctions_winrt.h b/src/corelib/kernel/qfunctions_winrt.h index dc1cbe0adef..9af5a08a01e 100644 --- a/src/corelib/kernel/qfunctions_winrt.h +++ b/src/corelib/kernel/qfunctions_winrt.h @@ -203,6 +203,9 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr &asyncOp, Awai if (FAILED(hr) || status != Completed) { HRESULT ec; hr = asyncInfo->get_ErrorCode(&ec); + if (FAILED(hr)) + return hr; + hr = asyncInfo->Close(); if (FAILED(hr)) return hr; return ec;