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:
@@ -445,7 +445,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_stream->Flush();
|
m_stream->Flush();
|
||||||
m_videoRenderer->setActive(false);
|
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
|
HRESULT __stdcall OnClockStart(MFTIME systemTime, LONGLONG clockStartOffset) Q_DECL_OVERRIDE
|
||||||
@@ -624,8 +624,10 @@ void QWinRTCameraControl::setState(QCamera::State state)
|
|||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
emit error(QCamera::InvalidRequestError, qt_error_string(hr));
|
emit error(QCamera::InvalidRequestError, qt_error_string(hr));
|
||||||
|
|
||||||
d->mediaSink->Shutdown();
|
if (d->mediaSink) {
|
||||||
d->mediaSink.Reset();
|
d->mediaSink->Shutdown();
|
||||||
|
d->mediaSink.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
d->state = QCamera::LoadedState;
|
d->state = QCamera::LoadedState;
|
||||||
emit stateChanged(d->state);
|
emit stateChanged(d->state);
|
||||||
|
|||||||
Reference in New Issue
Block a user