[libcamera-devel] [PATCH v2 3/8] android: CameraHalManager: Fix a function call of a moved Camera
Jacopo Mondi
jacopo at jmondi.org
Thu Mar 25 09:37:40 CET 2021
Hi Hiro,
On Wed, Mar 24, 2021 at 04:07:52PM +0900, Hirokazu Honda wrote:
> libcamera::Camera::id() is called after std::move() in
> cameraAdded(). This fixes the issue by not executing std::move().
>
> Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> ---
> src/android/camera_hal_manager.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp
> index b501f8db..f70cd8a8 100644
> --- a/src/android/camera_hal_manager.cpp
> +++ b/src/android/camera_hal_manager.cpp
> @@ -115,7 +115,7 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)
> }
>
> /* Create a CameraDevice instance to wrap the libcamera Camera. */
> - std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, std::move(cam));
> + std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam);
Furthermore, the shared pointer reference counter will be anyway
decreased when 'cam' goes out of scope.. So no need for move in any
way
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Thanks
j
> int ret = camera->initialize();
> if (ret) {
> LOG(HAL, Error) << "Failed to initialize camera: " << cam->id();
> --
> 2.31.0.291.g576ba9dcdaf-goog
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
More information about the libcamera-devel
mailing list