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 <oliver.wolff@qt.io>
This commit is contained in:
parent
3394d97edf
commit
038c57f4b3
@ -203,6 +203,9 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user