[RFC,v3,02/21] apps: common: event_loop: Disable copy/move
diff mbox series

Message ID 20250130115001.1129305-3-pobrn@protonmail.com
State New
Headers show
Series
  • apps: lc-compliance: Multi-stream tests
Related show

Commit Message

Barnabás Pőcze Jan. 30, 2025, 11:50 a.m. UTC
The compiler generated functions are not appropriate, so
delete the copy/move constructor/assignment to avoid
potential issues.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
---
 src/apps/common/event_loop.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jacopo Mondi Feb. 3, 2025, 7:14 p.m. UTC | #1
Hi Barnabás

On Thu, Jan 30, 2025 at 11:50:13AM +0000, Barnabás Pőcze wrote:
> The compiler generated functions are not appropriate, so
> delete the copy/move constructor/assignment to avoid
> potential issues.
>
> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  src/apps/common/event_loop.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/apps/common/event_loop.h b/src/apps/common/event_loop.h
> index d7d012c76..4e8dd0a46 100644
> --- a/src/apps/common/event_loop.h
> +++ b/src/apps/common/event_loop.h
> @@ -13,6 +13,8 @@
>  #include <memory>
>  #include <mutex>
>
> +#include <libcamera/base/class.h>
> +
>  #include <event2/util.h>
>
>  struct event_base;
> @@ -43,8 +45,11 @@ public:
>  			   std::function<void()> &&handler);
>
>  private:
> +	LIBCAMERA_DISABLE_COPY_AND_MOVE(EventLoop)
> +
>  	struct Event {
>  		Event(std::function<void()> &&callback);
> +		LIBCAMERA_DISABLE_COPY_AND_MOVE(Event)
>  		~Event();
>
>  		static void dispatch(int fd, short events, void *arg);
> --
> 2.48.1
>
>

Patch
diff mbox series

diff --git a/src/apps/common/event_loop.h b/src/apps/common/event_loop.h
index d7d012c76..4e8dd0a46 100644
--- a/src/apps/common/event_loop.h
+++ b/src/apps/common/event_loop.h
@@ -13,6 +13,8 @@ 
 #include <memory>
 #include <mutex>
 
+#include <libcamera/base/class.h>
+
 #include <event2/util.h>
 
 struct event_base;
@@ -43,8 +45,11 @@  public:
 			   std::function<void()> &&handler);
 
 private:
+	LIBCAMERA_DISABLE_COPY_AND_MOVE(EventLoop)
+
 	struct Event {
 		Event(std::function<void()> &&callback);
+		LIBCAMERA_DISABLE_COPY_AND_MOVE(Event)
 		~Event();
 
 		static void dispatch(int fd, short events, void *arg);