[libcamera-devel] [RFC v3 1/5] HACK: Camera public destructor

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Dec 9 11:05:56 CET 2021


Quoting Tomi Valkeinen (2021-12-09 09:29:02)
> pybind11 needs a public destructor for Camera to be able to manage the
> shared_ptr. It's not clear why this is needed, and can it be fixed in
> pybind11.
> 

:-( The 'HACK' here seems to be the only thing that would count as a
blocker to integration.

I wonder if this is really a HACK or if we just need to explain that the
destructor needs to be public to support the python bindings, but I
myself don't understand the reasoning itself.

Is the python code the only instance where we create a shared_ptr for
the Camera? If that's true - then perhaps this patch should actually be
squashed with the one that returns the Camera as a shared_ptr...

--
Kieran


> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
> ---
>  include/libcamera/camera.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h
> index a7759ccb..88a61ff5 100644
> --- a/include/libcamera/camera.h
> +++ b/include/libcamera/camera.h
> @@ -104,12 +104,12 @@ public:
>         int start(const ControlList *controls = nullptr);
>         int stop();
>  
> +       ~Camera();
>  private:
>         LIBCAMERA_DISABLE_COPY(Camera)
>  
>         Camera(std::unique_ptr<Private> d, const std::string &id,
>                const std::set<Stream *> &streams);
> -       ~Camera();
>  
>         friend class PipelineHandler;
>         void disconnect();
> -- 
> 2.25.1
>


More information about the libcamera-devel mailing list