[libcamera-devel,2/2] android: Disable copy and move for CameraDevice
diff mbox series

Message ID 20210704233620.9145-2-laurent.pinchart@ideasonboard.com
State Accepted
Delegated to: Laurent Pinchart
Headers show
Series
  • [libcamera-devel,1/2] android: Disable copy and move for CameraHalManager
Related show

Commit Message

Laurent Pinchart July 4, 2021, 11:36 p.m. UTC
Instances of the CameraDevice class should never be copied or moved, as
they represent resources, Disable copying and moving for the class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/android/camera_device.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paul Elder July 5, 2021, 3:13 a.m. UTC | #1
Hi Laurent,

On Mon, Jul 05, 2021 at 02:36:20AM +0300, Laurent Pinchart wrote:
> Instances of the CameraDevice class should never be copied or moved, as
> they represent resources, Disable copying and moving for the class.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/android/camera_device.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> index 3361918d4484..d085a27f296b 100644
> --- a/src/android/camera_device.h
> +++ b/src/android/camera_device.h
> @@ -14,6 +14,7 @@
>  
>  #include <hardware/camera3.h>
>  
> +#include <libcamera/base/class.h>
>  #include <libcamera/base/log.h>
>  #include <libcamera/base/message.h>
>  #include <libcamera/base/thread.h>
> @@ -66,6 +67,8 @@ protected:
>  	std::string logPrefix() const override;
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraDevice)
> +
>  	CameraDevice(unsigned int id, std::shared_ptr<libcamera::Camera> camera);
>  
>  	struct Camera3RequestDescriptor {
> -- 
> Regards,
> 
> Laurent Pinchart
>
Umang Jain July 5, 2021, 4:58 a.m. UTC | #2
Hi Laurent,

Thank you for the patch.

On 7/5/21 5:06 AM, Laurent Pinchart wrote:
> Instances of the CameraDevice class should never be copied or moved, as
> they represent resources, Disable copying and moving for the class.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   src/android/camera_device.h | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> index 3361918d4484..d085a27f296b 100644
> --- a/src/android/camera_device.h
> +++ b/src/android/camera_device.h
> @@ -14,6 +14,7 @@
>   
>   #include <hardware/camera3.h>
>   
> +#include <libcamera/base/class.h>
>   #include <libcamera/base/log.h>
>   #include <libcamera/base/message.h>
>   #include <libcamera/base/thread.h>
> @@ -66,6 +67,8 @@ protected:
>   	std::string logPrefix() const override;
>   
>   private:
> +	LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraDevice)
> +
>   	CameraDevice(unsigned int id, std::shared_ptr<libcamera::Camera> camera);
>   
>   	struct Camera3RequestDescriptor {

Patch
diff mbox series

diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 3361918d4484..d085a27f296b 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -14,6 +14,7 @@ 
 
 #include <hardware/camera3.h>
 
+#include <libcamera/base/class.h>
 #include <libcamera/base/log.h>
 #include <libcamera/base/message.h>
 #include <libcamera/base/thread.h>
@@ -66,6 +67,8 @@  protected:
 	std::string logPrefix() const override;
 
 private:
+	LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraDevice)
+
 	CameraDevice(unsigned int id, std::shared_ptr<libcamera::Camera> camera);
 
 	struct Camera3RequestDescriptor {