[libcamera-devel] [PATCH 5/5] libcamera: MappedBuffer: Delete copy and assignment

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Oct 22 15:56:05 CEST 2020


Prevent copying and assignment of MappedBuffer types, which could invoke unmapping
or mapped memory.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 include/libcamera/internal/buffer.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
index b7b0173f93f5..8c7126482b95 100644
--- a/include/libcamera/internal/buffer.h
+++ b/include/libcamera/internal/buffer.h
@@ -10,6 +10,7 @@
 #include <sys/mman.h>
 #include <vector>
 
+#include <libcamera/class.h>
 #include <libcamera/buffer.h>
 #include <libcamera/span.h>
 
@@ -34,6 +35,9 @@ protected:
 
 	int error_;
 	std::vector<Plane> maps_;
+
+private:
+	DELETE_COPY_AND_ASSIGN(MappedBuffer);
 };
 
 class MappedFrameBuffer : public MappedBuffer
-- 
2.25.1



More information about the libcamera-devel mailing list