From c8b88cd02752fb623f65dc3fe930d60fc00fd15d Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 24 Jun 2014 17:08:03 +0200 Subject: Android: fix crash when stopping the camera while a recording is active When unloading the camera, any active recording is automatically stopped, which in turn triggers the viewfinder to be restarted... We don't try anymore to restart the viewfinder after stopping recording unless the camera is still active. Change-Id: I77e4e3fc8d7116ac660d8bb23f6c400ebed4ffed Reviewed-by: Christian Stromme --- src/plugins/android/src/mediacapture/qandroidcapturesession.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp b/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp index 44901a6c1..c053c8e38 100644 --- a/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp +++ b/src/plugins/android/src/mediacapture/qandroidcapturesession.cpp @@ -269,7 +269,7 @@ void QAndroidCaptureSession::stop(bool error) delete m_mediaRecorder; m_mediaRecorder = 0; - if (m_cameraSession) { + if (m_cameraSession && m_cameraSession->status() == QCamera::ActiveStatus) { // Viewport needs to be restarted after recording restartViewfinder(); } @@ -516,6 +516,7 @@ void QAndroidCaptureSession::updateStatus() if (m_cameraSession->status() == QCamera::StoppingStatus || !m_cameraSession->captureMode().testFlag(QCamera::CaptureVideo)) { setState(QMediaRecorder::StoppedState); + return; } if (m_state == QMediaRecorder::RecordingState) { -- cgit v1.2.1