From patchwork Sun Mar 10 01:30:04 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: 19650 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 3A6A0BD1F1 for ; Sun, 10 Mar 2024 01:30:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D952E62874; Sun, 10 Mar 2024 02:30:24 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="RFRbsOSm"; dkim-atps=neutral Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5755B62872 for ; Sun, 10 Mar 2024 02:30:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1710034222; x=1710293422; bh=hYDEePEGUuUyQDkfnqPPozlg304XbTs7eCFonztO+sk=; 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=RFRbsOSm4Yd9mVpCBW49Aa7zEIyVC9DO/ZpLYuV6DiZ5AN1fKnwMQkYJK9rkAJGdT DgFgj3q5GYLhMxVWJBG1Xe3S3uSxFudv0AsRmETtbVGOpxn6J9hqbYIxhAGOz5CEj+ uaP5KvC4jdn/2u8gDxiIBYsMOe3hvyZZlUFS3KyJmy3jjdA6yhIvNM8M9OfdLEMGH3 SC6rbVYsYQV2y853xNOznNjRC7Ioo5bUGbaXmMEYk9/Dh3w4ZhbFcqI7DUwqJCr+NI 5y5kDFRuKKoOJGevUfpdV9+8eoNVPN3cSnqslRXr9n6T1zJ1WoYRGOUdIR7cKr7cMT Xr0ofyrkcZQ1w== Date: Sun, 10 Mar 2024 01:30:04 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v1 3/3] libcamera: framebuffer_allocator: remove entry if allocation fails Message-ID: <20240310012946.727641-4-pobrn@protonmail.com> In-Reply-To: <20240310012946.727641-1-pobrn@protonmail.com> References: <20240310012946.727641-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. --- 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; }