summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Nevala <samuel.nevala@intopalo.com>2015-10-14 10:33:57 +0300
committerSamuel Nevala <samuel.nevala@intopalo.com>2015-10-14 08:38:26 +0000
commitd50a09965ae53e02caabdbcf4994ed9bc0ea3293 (patch)
tree2b8b877f933dd63274f8514e97d206c9d7189203 /src
parent3727a588eeac37bf8830146efe76695361e6a343 (diff)
downloadqtmultimedia-d50a09965ae53e02caabdbcf4994ed9bc0ea3293.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/winrt/qwinrtcameracontrol.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/winrt/qwinrtcameracontrol.cpp b/src/plugins/winrt/qwinrtcameracontrol.cpp
index d20955da3..3489048d8 100644
--- a/src/plugins/winrt/qwinrtcameracontrol.cpp
+++ b/src/plugins/winrt/qwinrtcameracontrol.cpp
@@ -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);