[libcamera-devel] [PATCH v2] libcamera: pipeline: simple: Only connect created converters

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Oct 24 01:44:26 CEST 2020


Hi Kieran,

Thank you for the patch.

On Fri, Oct 23, 2020 at 11:11:54AM +0100, Kieran Bingham wrote:
> 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 <tomi.valkeinen at iki.fi>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> ---
>  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);
>  	}
>  
>  	/*

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list