summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-02 12:23:40 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-08 11:51:16 +0000
commit2cf0c87511caccabdea39a9e65aef10bf5f48c19 (patch)
tree51d840549baf9a70ecd8a18296ace46d3e140efc
parentde1b994bbaa4e34dc39c997d99f47026e7cddcfe (diff)
libcamera: Request: validate state on complete
Requests should only be completed from the RequestPending state. Requests which are completed from the RequestCancelled, or RequestComplete state, will indicate that a double-complete has been called on the Request, or that it has been used internally after it has been given back to the application. Ensure that this can be caught early if it occurs by enforcing the state required with an assert. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <email@uajain.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/request.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index e561ce1d..24c3694d 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -262,7 +262,9 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const
*/
void Request::complete()
{
+ ASSERT(status_ == RequestPending);
ASSERT(!hasPendingBuffers());
+
status_ = cancelled_ ? RequestCancelled : RequestComplete;
LOG(Request, Debug)