[{"id":33258,"web_url":"https://patchwork.libcamera.org/comment/33258/","msgid":"<b77uzdnqc4f4aywqjjgsapculjqczjlblt2kewspw7xdfc52kd@55bsr4ng33ku>","date":"2025-02-03T16:18:40","subject":"Re: [RFC PATCH v1] libcamera: base: object,\n\tthread: Disable copy/move","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Barnabás\n\nOn Thu, Jan 30, 2025 at 07:54:33PM +0000, Barnabás Pőcze wrote:\n> Objects of type `Object` and `Thread` have address identities, so they\n> should not be just moved/copied. And the special member functions\n> generated by the compiler do not do the right thing. So delete them.\n>\n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n\nThe CI loop is happy with this, so am I\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\n> ---\n>  include/libcamera/base/object.h | 3 +++\n>  include/libcamera/base/thread.h | 3 +++\n>  2 files changed, 6 insertions(+)\n>\n> diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h\n> index 508773cd0..6cb935a04 100644\n> --- a/include/libcamera/base/object.h\n> +++ b/include/libcamera/base/object.h\n> @@ -12,6 +12,7 @@\n>  #include <vector>\n>\n>  #include <libcamera/base/bound_method.h>\n> +#include <libcamera/base/class.h>\n>\n>  namespace libcamera {\n>\n> @@ -52,6 +53,8 @@ protected:\n>  \tbool assertThreadBound(const char *message);\n>\n>  private:\n> +\tLIBCAMERA_DISABLE_COPY_AND_MOVE(Object)\n> +\n>  \tfriend class SignalBase;\n>  \tfriend class Thread;\n>\n> diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h\n> index 3209d4f7c..3cbf6398e 100644\n> --- a/include/libcamera/base/thread.h\n> +++ b/include/libcamera/base/thread.h\n> @@ -13,6 +13,7 @@\n>\n>  #include <libcamera/base/private.h>\n>\n> +#include <libcamera/base/class.h>\n>  #include <libcamera/base/message.h>\n>  #include <libcamera/base/signal.h>\n>  #include <libcamera/base/span.h>\n> @@ -54,6 +55,8 @@ protected:\n>  \tvirtual void run();\n>\n>  private:\n> +\tLIBCAMERA_DISABLE_COPY_AND_MOVE(Thread)\n> +\n>  \tvoid startThread();\n>  \tvoid finishThread();\n>\n> --\n> 2.48.1\n>\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 55514C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Feb 2025 16:18:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 304B16858D;\n\tMon,  3 Feb 2025 17:18:45 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 365A261876\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Feb 2025 17:18:44 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 87C8A497;\n\tMon,  3 Feb 2025 17:17:32 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"JPMg4gUP\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1738599452;\n\tbh=i5MRXfFUhyFjSFVcw/mTLn8FpR/NIED5n8dRn0LwVGs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JPMg4gUPJzGzlIn4iqm+DXgIWjWvCiYRRqv77yOhEnfcnBE22ZKC6j1dIG+3HRpDK\n\tAmO2s9uNr7M1norpCs7oEysgqyKRhbuziJg2nZloxm0MHy7ZYSYYMlTvyZZfPjfW0O\n\tbLg8i09YvA3+Jt+dc8jpU2BPvqM8qW9V1R25tZSw=","Date":"Mon, 3 Feb 2025 17:18:40 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1] libcamera: base: object,\n\tthread: Disable copy/move","Message-ID":"<b77uzdnqc4f4aywqjjgsapculjqczjlblt2kewspw7xdfc52kd@55bsr4ng33ku>","References":"<20250130195429.1229777-1-pobrn@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250130195429.1229777-1-pobrn@protonmail.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":33259,"web_url":"https://patchwork.libcamera.org/comment/33259/","msgid":"<20250203162148.GA18887@pendragon.ideasonboard.com>","date":"2025-02-03T16:21:48","subject":"Re: [RFC PATCH v1] libcamera: base: object,\n\tthread: Disable copy/move","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Thu, Jan 30, 2025 at 07:54:33PM +0000, Barnabás Pőcze wrote:\n> Objects of type `Object` and `Thread` have address identities, so they\n> should not be just moved/copied. And the special member functions\n> generated by the compiler do not do the right thing. So delete them.\n> \n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/base/object.h | 3 +++\n>  include/libcamera/base/thread.h | 3 +++\n>  2 files changed, 6 insertions(+)\n> \n> diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h\n> index 508773cd0..6cb935a04 100644\n> --- a/include/libcamera/base/object.h\n> +++ b/include/libcamera/base/object.h\n> @@ -12,6 +12,7 @@\n>  #include <vector>\n>  \n>  #include <libcamera/base/bound_method.h>\n> +#include <libcamera/base/class.h>\n>  \n>  namespace libcamera {\n>  \n> @@ -52,6 +53,8 @@ protected:\n>  \tbool assertThreadBound(const char *message);\n>  \n>  private:\n> +\tLIBCAMERA_DISABLE_COPY_AND_MOVE(Object)\n> +\n>  \tfriend class SignalBase;\n>  \tfriend class Thread;\n>  \n> diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h\n> index 3209d4f7c..3cbf6398e 100644\n> --- a/include/libcamera/base/thread.h\n> +++ b/include/libcamera/base/thread.h\n> @@ -13,6 +13,7 @@\n>  \n>  #include <libcamera/base/private.h>\n>  \n> +#include <libcamera/base/class.h>\n>  #include <libcamera/base/message.h>\n>  #include <libcamera/base/signal.h>\n>  #include <libcamera/base/span.h>\n> @@ -54,6 +55,8 @@ protected:\n>  \tvirtual void run();\n>  \n>  private:\n> +\tLIBCAMERA_DISABLE_COPY_AND_MOVE(Thread)\n> +\n>  \tvoid startThread();\n>  \tvoid finishThread();\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 13520C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Feb 2025 16:21:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5AFBC61876;\n\tMon,  3 Feb 2025 17:21:53 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 31EFA61876\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Feb 2025 17:21:52 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 86830497;\n\tMon,  3 Feb 2025 17:20:40 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Xn7+rRoA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1738599640;\n\tbh=FdrOUF3kFaaGEdkkslU0/+oivsLpSpASunUq03XrLY0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Xn7+rRoAp+FvZ2n96O9ymixS+etIsB/vKw+k2ABOyAZrKWE58Mhg8u9SmDVi/H+EN\n\tIqYawBtdMT5KZfYb1P3HfYtA0P6zU9GHDTXgoTUXw2kSHaBNQQ2T+01TWftkZWT4SU\n\tefXHyvP4w+4nNZQZAOhfy8tl3VmY1xH5OJbUk39s=","Date":"Mon, 3 Feb 2025 18:21:48 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1] libcamera: base: object,\n\tthread: Disable copy/move","Message-ID":"<20250203162148.GA18887@pendragon.ideasonboard.com>","References":"<20250130195429.1229777-1-pobrn@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250130195429.1229777-1-pobrn@protonmail.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]