From 5718b4d5b7c8808b1d6137f90fc4690e15349c3d Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Wed, 10 Mar 2021 17:40:20 +0000 Subject: libcamera: camera: Validate requests are completed in Running state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All requests must have completed before the Camera has fully stopped. Requests completing when the camera is not running represent an internal pipeline handler bug. Trap this event with a fatal error. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- src/libcamera/camera.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/libcamera/camera.cpp') diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 84edbb8f..dec8171e 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -1062,11 +1062,11 @@ int Camera::stop() LOG(Camera, Debug) << "Stopping capture"; - d->setState(Private::CameraConfigured); - d->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking, this); + d->setState(Private::CameraConfigured); + return 0; } @@ -1079,6 +1079,12 @@ int Camera::stop() */ void Camera::requestComplete(Request *request) { + Private *const d = LIBCAMERA_D_PTR(); + + /* Disconnected cameras are still able to complete requests. */ + if (d->isAccessAllowed(Private::CameraRunning, true)) + LOG(Camera, Fatal) << "Trying to complete a request when stopped"; + requestCompleted.emit(request); } -- cgit v1.2.1