From patchwork Sun Mar 5 23:06:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sophie Friedrich X-Patchwork-Id: 18341 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 1DB4DBE080 for ; Sun, 5 Mar 2023 23:06:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C2B0562676; Mon, 6 Mar 2023 00:06:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678057618; bh=OXCQBEdhIybGXgYB5OXHUckasntp5bKLKuImz2BMVN4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=R2gaSVEKhqm7Uky4t8kFqCU/hcjkoJ0Ux65vp6RWMNpWzLtI0+BwA0w91Ekw/eQmP PwzkOQ2xNMI68Wus/XJfiO6aYJeTKOSUOLV4d/GaDPd5l1b4hm48QE20r/DCuarCJp FToG55ZU63y8MrXDQZXQfmHi6boqNik1HbcIRAQ44il8YemlE/ihh9udqBMo/BeKwz Y0G+vBFmuMpD18deGNhhmsFOepKC14fhZ+Xv4WYPvO2GH8bmBmYqE2+ShQJsXbAFol C3V/Gjvbd1YEuR1YwJC/5h2NdVcdcuKWNxGbxgYOATjrQTcgDdpwnmbP6LhDnDdtDK D8ku6/hTq2U+g== Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CEA076261A for ; Mon, 6 Mar 2023 00:06:56 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=flowerpot.me header.i=@flowerpot.me header.b="O8fErpid"; dkim-atps=neutral Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4PVHQk3DFZz9sbF; Mon, 6 Mar 2023 00:06:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flowerpot.me; s=MBO0001; t=1678057614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tRwjoB9L9HJ1MTKvBxQhNunVjymqKUMDMm07saz9dRk=; b=O8fErpidD9VZwLLiLG2H2ZGQnWQu46NT2I7lsLEdE8ZKXdNpJJG17fDy138HwVlVaxkiDi +1NgeKtkFBtdCz7YDfOE6B0CaEVFctj29M3pnPsd6aszVpQGp7vdZiZQCpTUOg+0vvFK8w SXkuPubT3ZQttwCI7wXfzwN1dcQusH26TVRB8lYB2AelUHzRcUrfRVL2hpaGduFhbjbUQB d2RnhcLnHkLMqFjYrfxmNKPYNLNgcBBuwCVQw9uP0GPkyZC38PiLNqH/X4d/ZcOTVeN/9/ MrRsz6HFBCnAe4PF0c31YTRAsLzLpESvL2/pVb1VSC6S59Y6iWqrIkaDBxu6qg== To: libcamera-devel@lists.libcamera.org Date: Mon, 6 Mar 2023 00:06:03 +0100 Message-Id: <20230305230603.3697024-2-dev@flowerpot.me> In-Reply-To: <20230305230603.3697024-1-dev@flowerpot.me> References: <20230305230603.3697024-1-dev@flowerpot.me> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/1] fix: pipeline handlers: Stop exponential explosive calls to createPipelineHandlers 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: , X-Patchwork-Original-From: Sophie Friedrich via libcamera-devel From: Sophie Friedrich Reply-To: Sophie Friedrich Cc: Sophie Friedrich Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Currently the method `createPipelineHandlers` registered itself to the `devicesAdded` signal at the end of each call. As the Signal object supports multiple non-unique listeners connected to it, the former method would be called exponentially often with each new emitted event on `devicesAdded` (i.e. with udev plugging in a new camera) By attaching the `createPipelineHandlers` function to `devicesAdded` during the first call to it / init of the `CameraManager::Private` this effect is prevented. Signed-off-by: Sophie Friedrich Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/libcamera/camera_manager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index b1785f75..c1edefda 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -131,6 +131,7 @@ int CameraManager::Private::init() return -ENODEV; createPipelineHandlers(); + enumerator_->devicesAdded.connect(this, &Private::createPipelineHandlers); return 0; } @@ -165,8 +166,6 @@ void CameraManager::Private::createPipelineHandlers() << "\" matched"; } } - - enumerator_->devicesAdded.connect(this, &Private::createPipelineHandlers); } void CameraManager::Private::cleanup()