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:
Samuel Nevala
2015-10-22 12:31:12 +03:00
parent f24362fd2a
commit ac1b772ec8

View File

@@ -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);