From patchwork Mon Nov 25 00:08:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22065 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 D2C43C3272 for ; Mon, 25 Nov 2024 00:08:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 09C6D65FFB; Mon, 25 Nov 2024 01:08:47 +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="H+eOrGK0"; dkim-atps=neutral Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D2F065FC6 for ; Mon, 25 Nov 2024 01:08:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1732493323; x=1732752523; bh=06YHYQTTr3Izb/QnaaCVW31lpjIOtVEF1KpBqUz4FeU=; 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=H+eOrGK0lLJtTKjwvQBWQxEZLV4nze988GJ8brT9Va13rW2zxfX87BgN6WEbp1+0t JJQIrFnoPZTrmIhcuYDXDtd1+i4nyYlzBxXOi8PaItt0v/ZITvDN0eMMlfkjdMCUHc 7nHM8rbpZ0B8N8/w8aE1WSzb2IAQ2lGWBGH4n8AsP06wy64nRH8zxeQUuMcp4YYRuk /k0kYwZqcd5kUfEsAcAbcwlfCG9f6OG1CyikE5Od8VgeQDTi461H8NtV1J8H7whhgU K8j3y6RlKkp49KXbrecmBAD8v1eYvSAUtSJw4QYZ/I5a913GOCxshzfRaez0tgBkoB tNtUSUvqYvuhg== Date: Mon, 25 Nov 2024 00:08:37 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v1] libcamera: camera: Fix clearing of stream associations before `validate()` Message-ID: <20241125000834.396815-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: 5fb2b12e29c82d62f85856e3bbfd745567252efb 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" A copy is made in the range-based for loop, and thus `setStream()` operates on this copy, leading to the `stream_` member of the given `StreamConfiguration` object in `*config` never being set to `nullptr`. Fix that by taking a reference in the range-based for loop. Also rename the variable from `it` since it is not an iterator. Fixes: 4217c9f1aa863c ("libcamera: camera: Zero streams before validate()") Reviewed-by: Kieran Bingham --- src/libcamera/camera.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 25135d46..82a5186a 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -1178,8 +1178,8 @@ int Camera::configure(CameraConfiguration *config) if (ret < 0) return ret; - for (auto it : *config) - it.setStream(nullptr); + for (auto &cfg : *config) + cfg.setStream(nullptr); if (config->validate() != CameraConfiguration::Valid) { LOG(Camera, Error)