summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-10 17:40:20 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-29 12:33:50 +0100
commit5718b4d5b7c8808b1d6137f90fc4690e15349c3d (patch)
treeb5af6a43b11f591bd81294730cfca11ed923027a
parent1dfb8d45dc04222d3d2f2bb3a8622a7e59d68228 (diff)
libcamera: camera: Validate requests are completed in Running state
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 <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/camera.cpp10
1 files changed, 8 insertions, 2 deletions
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);
}