[{"id":38823,"web_url":"https://patchwork.libcamera.org/comment/38823/","msgid":"<20260508120417.GJ2176058@killaraus.ideasonboard.com>","date":"2026-05-08T12:04:17","subject":"Re: [PATCH v1 2/2] libcamera: base: bound_method: Forward when\n\tinvoking","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 Fri, May 08, 2026 at 11:28:16AM +0200, Barnabás Pőcze wrote:\n> This implements the same kind of change for pack-based invoking as 9c86a405b72a\n> (\"libcamera: base: bound_method: Forward arguments when possible\") did for the\n> other cases.\n> \n> At the moment a single argument pack is used just once, hence it is safe\n> to forward the arguments from the pack, allowing moving to take place\n> instead of copying. So do that.\n\nThis seems useful for Object::invokeMethod(). I'm a bit concerned that\nwe're slowly moving towards a situation where the Signal class would\ncompile with rvalue reference arguments though. That would lead to\nundefined behaviour if the signal gets connected to multiple slots.\n\nMaybe rvalue references for signals are desirable if we enforce that the\nsignal gets connected once and once only, but that's a separate\ndiscussion. For the time being, my mind would find peace if you could\nadd a static assert to the Signal class to avoid this issue.\n\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/base/bound_method.h | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/include/libcamera/base/bound_method.h b/include/libcamera/base/bound_method.h\n> index cb642e0a9b..9b42a8a1e8 100644\n> --- a/include/libcamera/base/bound_method.h\n> +++ b/include/libcamera/base/bound_method.h\n> @@ -97,9 +97,9 @@ private:\n>  \t\t[[maybe_unused]] auto *args = static_cast<PackType *>(pack);\n>  \n>  \t\tif constexpr (!std::is_void_v<R>)\n> -\t\t\targs->ret_ = invoke(std::get<I>(args->args_)...);\n> +\t\t\targs->ret_ = invoke(std::forward<Args>(std::get<I>(args->args_))...);\n>  \t\telse\n> -\t\t\tinvoke(std::get<I>(args->args_)...);\n> +\t\t\tinvoke(std::forward<Args>(std::get<I>(args->args_))...);\n>  \t}\n>  \n>  public:","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 DF10FBDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 May 2026 12:04:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1E88563029;\n\tFri,  8 May 2026 14:04:20 +0200 (CEST)","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 90D3162FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2026 14:04:18 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 926FE9A4;\n\tFri,  8 May 2026 14:04:13 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oH9vvLzI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778241853;\n\tbh=VGsZitIDsjuZojZ+oGuJJRdFY6M6x2+Yx9euABcIg9Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oH9vvLzIROGcLPHKWbJs8aDSlYbaDq/MaW/84cN3Hg71XFIJxTBGsmUDSFDoBWDcb\n\tNIgCzSPDm7a7m+PrB82XJypgFJJjpSf8Mw23kIxvBmlo43gg49dBe13FovuK2/A6QZ\n\tuTwlFmBJkMXqkZV6M6ASyHqovcTJ8kgc7BlreJUM=","Date":"Fri, 8 May 2026 15:04:17 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1 2/2] libcamera: base: bound_method: Forward when\n\tinvoking","Message-ID":"<20260508120417.GJ2176058@killaraus.ideasonboard.com>","References":"<20260508092816.119642-1-barnabas.pocze@ideasonboard.com>\n\t<20260508092816.119642-2-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20260508092816.119642-2-barnabas.pocze@ideasonboard.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":38826,"web_url":"https://patchwork.libcamera.org/comment/38826/","msgid":"<177824849056.182289.13185319722711137496@ping.linuxembedded.co.uk>","date":"2026-05-08T13:54:50","subject":"Re: [PATCH v1 2/2] libcamera: base: bound_method: Forward when\n\tinvoking","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2026-05-08 13:04:17)\n> Hi Barnabás,\n> \n> Thank you for the patch.\n> \n> On Fri, May 08, 2026 at 11:28:16AM +0200, Barnabás Pőcze wrote:\n> > This implements the same kind of change for pack-based invoking as 9c86a405b72a\n> > (\"libcamera: base: bound_method: Forward arguments when possible\") did for the\n> > other cases.\n> > \n> > At the moment a single argument pack is used just once, hence it is safe\n> > to forward the arguments from the pack, allowing moving to take place\n> > instead of copying. So do that.\n> \n> This seems useful for Object::invokeMethod(). I'm a bit concerned that\n> we're slowly moving towards a situation where the Signal class would\n> compile with rvalue reference arguments though. That would lead to\n> undefined behaviour if the signal gets connected to multiple slots.\n> \n> Maybe rvalue references for signals are desirable if we enforce that the\n> signal gets connected once and once only, but that's a separate\n> discussion. For the time being, my mind would find peace if you could\n> add a static assert to the Signal class to avoid this issue.\n\nWell, as that's handled:\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> > ---\n> >  include/libcamera/base/bound_method.h | 4 ++--\n> >  1 file changed, 2 insertions(+), 2 deletions(-)\n> > \n> > diff --git a/include/libcamera/base/bound_method.h b/include/libcamera/base/bound_method.h\n> > index cb642e0a9b..9b42a8a1e8 100644\n> > --- a/include/libcamera/base/bound_method.h\n> > +++ b/include/libcamera/base/bound_method.h\n> > @@ -97,9 +97,9 @@ private:\n> >               [[maybe_unused]] auto *args = static_cast<PackType *>(pack);\n> >  \n> >               if constexpr (!std::is_void_v<R>)\n> > -                     args->ret_ = invoke(std::get<I>(args->args_)...);\n> > +                     args->ret_ = invoke(std::forward<Args>(std::get<I>(args->args_))...);\n> >               else\n> > -                     invoke(std::get<I>(args->args_)...);\n> > +                     invoke(std::forward<Args>(std::get<I>(args->args_))...);\n> >       }\n> >  \n> >  public:\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 8104BBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 May 2026 13:54:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B09C562FE1;\n\tFri,  8 May 2026 15:54:54 +0200 (CEST)","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 0B5C062FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2026 15:54:53 +0200 (CEST)","from monstersaurus.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2F0A6BCA;\n\tFri,  8 May 2026 15:54:48 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"lEl1dwQ5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778248488;\n\tbh=P7fvfL1+86/1Jp4tkZtPrgrFGLzptoDj+d/xjVUYPeA=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=lEl1dwQ5ihz5t3VyryKeEcxWNwmqhgGTD/QPAhefhm5E/1r5iybqN6KU0dJR0Vgtl\n\tRTGG/IozCWOHpBI8y0hLYK6Im6XUfAVrwo+41BpGNteC+aL1YAgPwaZAz0EZ+pJjpL\n\tDW3Ggc0rNW5rJYXukUKVPmLLQ+JwPhmS5TeIIRcw=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260508120417.GJ2176058@killaraus.ideasonboard.com>","References":"<20260508092816.119642-1-barnabas.pocze@ideasonboard.com>\n\t<20260508092816.119642-2-barnabas.pocze@ideasonboard.com>\n\t<20260508120417.GJ2176058@killaraus.ideasonboard.com>","Subject":"Re: [PATCH v1 2/2] libcamera: base: bound_method: Forward when\n\tinvoking","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Fri, 08 May 2026 14:54:50 +0100","Message-ID":"<177824849056.182289.13185319722711137496@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]