From patchwork Sun Mar 10 14:30:43 2024 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: 19654 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 88FB9BD160 for ; Sun, 10 Mar 2024 14:30:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3657E628AC; Sun, 10 Mar 2024 15:30:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="PNSKAEn4"; 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 C08A16286F for ; Sun, 10 Mar 2024 15:30:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1710081056; x=1710340256; bh=h3XnFFQ3vTbXJhLHKU2T6xJhgZ8mmSIXCJ9+l1CKwp4=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=PNSKAEn4Hsz9CkvYwh+zMWplnUtimYVVzb5AXuVb6jCVRcjvwsWJoSzumufEPzUOF OQO20ajCdfzy0+xZ2COquqZ5OGY4ROGWG9KkFD/boEZAQ6bxARvV6/EknW3mOSM8KL A0218PFbfhG0z1X1cOUB8FbaaA6ptR5bdXG6THQ8HC7cTDgW4w8Wz8dtMr5JFUzazm bZIwBGuQCePB2m3gTQ6Ykt7BMg4JyO58ncbqcxZ2qz8qAuuiH8lxdM2Ug9Hq+FAYGB B5tH4Bz3sidqP9clH0UPMdP8ZLZ1JHXfqmnO2HVDHKTlOX7/ThNj4y8P76A07GwgjS xI1ODEDnSFaEA== Date: Sun, 10 Mar 2024 14:30:43 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v2 3/3] libcamera: framebuffer_allocator: Remove entry if allocation fails Message-ID: <20240310143023.752559-4-pobrn@protonmail.com> In-Reply-To: <20240310143023.752559-1-pobrn@protonmail.com> References: <20240310143023.752559-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton 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" Remove the entry from the `buffers_` mapping if `Camera::exportFrameBuffers()` fails, otherwise there would be a stale entry in the map. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/libcamera/framebuffer_allocator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcamera/framebuffer_allocator.cpp b/src/libcamera/framebuffer_allocator.cpp index fc19a33a..dbd0db19 100644 --- a/src/libcamera/framebuffer_allocator.cpp +++ b/src/libcamera/framebuffer_allocator.cpp @@ -97,6 +97,10 @@ int FrameBufferAllocator::allocate(Stream *stream) LOG(Allocator, Error) << "Stream is not part of " << camera_->id() << " active configuration"; + + if (ret < 0) + buffers_.erase(it); + return ret; }