summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2025-01-30 19:54:33 +0000
committerBarnabás Pőcze <pobrn@protonmail.com>2025-02-04 18:18:50 +0100
commit9a7fce1b5146b38eb994cf5d14607f470169b933 (patch)
tree374b9e8f93eb3137535b8f2b256af5db89fbcaf8
parent2ae569dad2fee2b28fd093b8e0a7944a2cd6604b (diff)
libcamera: base: object,thread: Disable copy/move
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@protonmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--include/libcamera/base/object.h3
-rw-r--r--include/libcamera/base/thread.h3
2 files changed, 6 insertions, 0 deletions
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 <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 3209d4f7..3cbf6398 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();