From patchwork Fri Oct 23 10:11:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10212 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 AD2BCBDB13 for ; Fri, 23 Oct 2020 10:12:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 23EC5615DE; Fri, 23 Oct 2020 12:12:02 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Gi3GXwK2"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 72C4E61059 for ; Fri, 23 Oct 2020 12:12:01 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 768E7B26; Fri, 23 Oct 2020 12:12:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603447921; bh=Q/2I8U7LoupgmgduZY8YNqalPiS6/g7nBISs/w8lPDs=; h=From:To:Cc:Subject:Date:From; b=Gi3GXwK2tvXogOEOE4SmyP1SB2rAzBKrwjsT+EWMMw3kfgTPWH2Voico3G9lMotk2 np0p27UCPTlk52rZPTS0kXAuIRQ/G/fcR1Lb3ZEbMW0D5Pwgyzqjr3/0POpXa8co06 7yPrBqZQJf8yvD9ZID/Dnfd2wInvkMFXCRM13kiE= From: Kieran Bingham To: libcamera devel Date: Fri, 23 Oct 2020 11:11:54 +0100 Message-Id: <20201023101154.673143-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] libcamera: pipeline: simple: Only connect created converters 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: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If converter_->open() fails, the code deletes the converter_ but then happily goes on, and at the very next lines will use converter_ to connect the bufferReady signal. Ensure the converter is only connected when successfully opened by extending the conditional and connecting in an else scope instead. Reported-by: Tomi Valkeinen Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/simple/simple.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 0d48e1b6acca..3d2039f3f269 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -774,9 +774,9 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) << "Failed to open converter, disabling format conversion"; delete converter_; converter_ = nullptr; + } else { + converter_->bufferReady.connect(this, &SimplePipelineHandler::converterDone); } - - converter_->bufferReady.connect(this, &SimplePipelineHandler::converterDone); } /*