[RFC,v3,1/9] libcamera: process: Disable copy/move
diff mbox series

Message ID 20250325180821.1456154-2-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: process: Remove `ProcessManager` singleton
Related show

Commit Message

Barnabás Pőcze March 25, 2025, 6:08 p.m. UTC
A `Process` object has address identity because a pointer
to it is stored inside the `ProcessManager`. However, copy/move
special methods are still generated by the compiler. So disable
them to avoid potential issues and confusion.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 include/libcamera/internal/process.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kieran Bingham March 25, 2025, 7:09 p.m. UTC | #1
Quoting Barnabás Pőcze (2025-03-25 18:08:13)
> A `Process` object has address identity because a pointer
> to it is stored inside the `ProcessManager`. However, copy/move
> special methods are still generated by the compiler. So disable
> them to avoid potential issues and confusion.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  include/libcamera/internal/process.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h
> index b1d07a5a5..58e3e41ce 100644
> --- a/include/libcamera/internal/process.h
> +++ b/include/libcamera/internal/process.h
> @@ -42,6 +42,8 @@ public:
>         Signal<enum ExitStatus, int> finished;
>  
>  private:
> +       LIBCAMERA_DISABLE_COPY_AND_MOVE(Process)
> +
>         void closeAllFdsExcept(const std::vector<int> &fds);
>         int isolate();
>         void died(int wstatus);
> -- 
> 2.49.0
>
Laurent Pinchart March 26, 2025, 12:52 p.m. UTC | #2
Hi Barnabás,

Thank you for the patch.

On Tue, Mar 25, 2025 at 07:08:13PM +0100, Barnabás Pőcze wrote:
> A `Process` object has address identity because a pointer
> to it is stored inside the `ProcessManager`. However, copy/move
> special methods are still generated by the compiler. So disable
> them to avoid potential issues and confusion.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  include/libcamera/internal/process.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h
> index b1d07a5a5..58e3e41ce 100644
> --- a/include/libcamera/internal/process.h
> +++ b/include/libcamera/internal/process.h

You should include libcamera/base/class.h.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> @@ -42,6 +42,8 @@ public:
>  	Signal<enum ExitStatus, int> finished;
>  
>  private:
> +	LIBCAMERA_DISABLE_COPY_AND_MOVE(Process)
> +
>  	void closeAllFdsExcept(const std::vector<int> &fds);
>  	int isolate();
>  	void died(int wstatus);

Patch
diff mbox series

diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h
index b1d07a5a5..58e3e41ce 100644
--- a/include/libcamera/internal/process.h
+++ b/include/libcamera/internal/process.h
@@ -42,6 +42,8 @@  public:
 	Signal<enum ExitStatus, int> finished;
 
 private:
+	LIBCAMERA_DISABLE_COPY_AND_MOVE(Process)
+
 	void closeAllFdsExcept(const std::vector<int> &fds);
 	int isolate();
 	void died(int wstatus);