winrt: Fix crash when focus operation in progress.
If focus is locked repeatedly and fast on Lumia 920 FocusAsync returns null IAsyncAction and ::await crash on null pointer. Fix crash by returning early from method when operation in progress. Change-Id: Ie268fd2276d3e9090a47bf362cd58743bb83284a Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
This commit is contained in:
@@ -1154,6 +1154,8 @@ bool QWinRTCameraControl::focus()
|
||||
return false;
|
||||
ComPtr<IAsyncAction> op;
|
||||
HRESULT hr = d->focusControl->FocusAsync(&op);
|
||||
if (HRESULT_CODE(hr) == ERROR_OPERATION_IN_PROGRESS)
|
||||
return true;
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
hr = QWinRTFunctions::await(op, QWinRTFunctions::ProcessThreadEvents);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
|
||||
Reference in New Issue
Block a user