From 9a7fce1b5146b38eb994cf5d14607f470169b933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 30 Jan 2025 19:54:33 +0000 Subject: libcamera: base: object,thread: Disable copy/move MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- 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 508773cd..6cb935a0 100644 --- a/include/libcamera/base/object.h +++ b/include/libcamera/base/object.h @@ -12,6 +12,7 @@ #include #include +#include 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 3209d4f7..3cbf6398 100644 --- a/include/libcamera/base/thread.h +++ b/include/libcamera/base/thread.h @@ -13,6 +13,7 @@ #include +#include #include #include #include @@ -54,6 +55,8 @@ protected: virtual void run(); private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(Thread) + void startThread(); void finishThread(); -- cgit v1.2.1