From patchwork Thu Jan 30 19:54:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22708 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 05F85C3259 for ; Thu, 30 Jan 2025 19:54:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 19A6C68563; Thu, 30 Jan 2025 20:54:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="hv1ysGJH"; dkim-atps=neutral Received: from mail-10629.protonmail.ch (mail-10629.protonmail.ch [79.135.106.29]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 337036034C for ; Thu, 30 Jan 2025 20:54:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1738266879; x=1738526079; bh=Bl/vRrVcMSlt0T/duwjb/+fiz6PP1zsu/4YpYLFImpw=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=hv1ysGJHl51NHqm1ZdDRynaAMj0kqFJOOzY4xMdIY5gUi4f3w2A6LVXYGjY8zc8Ba dM6i7mYR7z3FsiljtiIIQZSmjT/DffyOCXgkrfWYnuAGY1r5SMz2bzmG/iJCjO8Wne tCGYMjHmFc29M1GAehU2ctXbSva7kLzPHYm4z6gl4mtGrt/R+/pgG62J/0z/FvhiEe 7r/TMW1SA89b5GDHsRIunHr1NVo3QrrRDuE/nOxSD/1E9FdaYxwj2dWXpB4ZzAbGwP y2pQckYIpHdmWDClwWfo1c+sFdCmrctLhhkBjjeP4pUGx5mFArt+LmNh3pDvLwG4/S 3xDe+ek7XYCQg== Date: Thu, 30 Jan 2025 19:54:33 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [RFC PATCH v1] libcamera: base: object,thread: Disable copy/move Message-ID: <20250130195429.1229777-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: ea6459bcef27cb0d024c12a7408a8184d8098f8c MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/base/object.h | 3 +++ include/libcamera/base/thread.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h index 508773cd0..6cb935a04 100644 --- a/include/libcamera/base/object.h +++ b/include/libcamera/base/object.h @@ -12,6 +12,7 @@ #include #include +#include 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 3209d4f7c..3cbf6398e 100644 --- a/include/libcamera/base/thread.h +++ b/include/libcamera/base/thread.h @@ -13,6 +13,7 @@ #include +#include #include #include #include @@ -54,6 +55,8 @@ protected: virtual void run(); private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(Thread) + void startThread(); void finishThread();