[RFC PATCH v1] libcamera: base: object,thread: Disable copy/move
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Mon Feb 3 17:18:40 CET 2025
Hi Barnabás
On Thu, Jan 30, 2025 at 07:54:33PM +0000, Barnabás Pőcze wrote:
> Objects of type `Object` and `Thread` have address identities, so they
> should not be just moved/copied. And the special member functions
> generated by the compiler do not do the right thing. So delete them.
>
> Signed-off-by: Barnabás Pőcze <pobrn at protonmail.com>
The CI loop is happy with this, so am I
Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
Thanks
j
> ---
> include/libcamera/base/object.h | 3 +++
> include/libcamera/base/thread.h | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h
> index 508773cd0..6cb935a04 100644
> --- a/include/libcamera/base/object.h
> +++ b/include/libcamera/base/object.h
> @@ -12,6 +12,7 @@
> #include <vector>
>
> #include <libcamera/base/bound_method.h>
> +#include <libcamera/base/class.h>
>
> namespace libcamera {
>
> @@ -52,6 +53,8 @@ protected:
> bool assertThreadBound(const char *message);
>
> private:
> + LIBCAMERA_DISABLE_COPY_AND_MOVE(Object)
> +
> friend class SignalBase;
> friend class Thread;
>
> diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
> index 3209d4f7c..3cbf6398e 100644
> --- a/include/libcamera/base/thread.h
> +++ b/include/libcamera/base/thread.h
> @@ -13,6 +13,7 @@
>
> #include <libcamera/base/private.h>
>
> +#include <libcamera/base/class.h>
> #include <libcamera/base/message.h>
> #include <libcamera/base/signal.h>
> #include <libcamera/base/span.h>
> @@ -54,6 +55,8 @@ protected:
> virtual void run();
>
> private:
> + LIBCAMERA_DISABLE_COPY_AND_MOVE(Thread)
> +
> void startThread();
> void finishThread();
>
> --
> 2.48.1
>
>
More information about the libcamera-devel
mailing list