winrt: Fix two possible null pointer exceptions

If camera state is changed rapidly these can occur.

Change-Id: Ia9ccf9e03162350cd411ff9fc059c14f47b9a42e
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
This commit is contained in:
Samuel Nevala
2015-10-14 10:33:57 +03:00
parent 3727a588ee
commit d50a09965a

View File

@@ -445,7 +445,7 @@ public:
{
m_stream->Flush();
m_videoRenderer->setActive(false);
return m_presentationClock->Stop();
return m_presentationClock ? m_presentationClock->Stop() : S_OK;
}
HRESULT __stdcall OnClockStart(MFTIME systemTime, LONGLONG clockStartOffset) Q_DECL_OVERRIDE
@@ -624,8 +624,10 @@ void QWinRTCameraControl::setState(QCamera::State state)
if (FAILED(hr))
emit error(QCamera::InvalidRequestError, qt_error_string(hr));
d->mediaSink->Shutdown();
d->mediaSink.Reset();
if (d->mediaSink) {
d->mediaSink->Shutdown();
d->mediaSink.Reset();
}
d->state = QCamera::LoadedState;
emit stateChanged(d->state);