path: root/src/corelib
diff options
authorMaurice Kalinowski <>2016-06-08 14:42:09 +0200
committerOliver Wolff <>2016-06-13 06:13:15 +0000
commit038c57f4b3aca1b35244fb9fbb0ae81c53279c6f (patch)
tree4126fc73d0f1e34b8c68badd25b26b3a362489ba /src/corelib
parent3394d97edfd6d1f5f4311868212831bb3ae03dfb (diff)
winrt: Close IAsyncInfo manually in case of error
In case QEventDispatcherWinRT::runOnXamlThread returns an error the runtime sets the status of IAsyncInfo to Error. At the point when the IAsyncInfo destructor is invoked, an unhandled exception is thrown indicating the error has not been handled, causing any application to just crash deep inside the Windows platform libraries. Hence, in case runOnXamlThread returns non-S_OK we have to manually invoke Close() of the IAsyncInfo to tell the system we have taken care of everything. Change-Id: I3ac1e2ec2726f42e44f4f9a92191e454711120dd Reviewed-by: Oliver Wolff <>
Diffstat (limited to 'src/corelib')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/kernel/qfunctions_winrt.h b/src/corelib/kernel/qfunctions_winrt.h
index dc1cbe0ade..9af5a08a01 100644
--- a/src/corelib/kernel/qfunctions_winrt.h
+++ b/src/corelib/kernel/qfunctions_winrt.h
@@ -205,6 +205,9 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
hr = asyncInfo->get_ErrorCode(&ec);
if (FAILED(hr))
return hr;
+ hr = asyncInfo->Close();
+ if (FAILED(hr))
+ return hr;
return ec;