[RFC PATCH v2 02/16] apps: common: event_loop: Disable copy/move
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Wed Jan 22 10:03:13 CET 2025
Hi Barnabás
On Tue, Jan 14, 2025 at 06:21:56PM +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 at protonmail.com>
The class has this member
std::list<std::unique_ptr<Event>> events_;
Is there a copy constructor generated for the class even if
unique_ptr<> do not provide one ?
> ---
> 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.0
>
>
More information about the libcamera-devel
mailing list