[libcamera-devel] [PATCH v2 01/16] libcamera: camera: Don't move buffers away from request at completion

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Jul 13 19:23:36 CEST 2019


For a historical reason that isn't fully understood, the request
completion handler in the Camera class moves all buffers away from the
request's buffer map to a local variable before emitting the request
completion signal. There's no reason to do so, and it makes it
impossible for requests to access buffers in their destructor. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/libcamera/camera.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 592dfd39eacc..094f1b63b7f1 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -894,8 +894,7 @@ int Camera::stop()
  */
 void Camera::requestComplete(Request *request)
 {
-	std::map<Stream *, Buffer *> buffers(std::move(request->bufferMap_));
-	requestCompleted.emit(request, buffers);
+	requestCompleted.emit(request, request->bufferMap_);
 	delete request;
 }
 
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list