From 459b3bc6a979a778f1689a86be3589101853977e Mon Sep 17 00:00:00 2001 From: Hirokazu Honda Date: Wed, 26 May 2021 17:46:28 +0900 Subject: android: CameraHalManager: Create a static object dynamically Originally CameraHalManager is created in the libcamera start up and destroyed in the libcamera termination. However, CameraHalManager destructor can access other static objects that has been destroyed. Avoid this issue by destroying CameraHalManager when tear_down() is called in ChromeOS or leaking it in other platforms. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Signed-off-by: Laurent Pinchart --- src/android/cros/camera3_hal.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/android/cros/camera3_hal.cpp') diff --git a/src/android/cros/camera3_hal.cpp b/src/android/cros/camera3_hal.cpp index 31ad36ac..d6fc1d0f 100644 --- a/src/android/cros/camera3_hal.cpp +++ b/src/android/cros/camera3_hal.cpp @@ -7,12 +7,15 @@ #include +#include "../camera_hal_manager.h" + static void set_up(cros::CameraMojoChannelManagerToken *token) { } static void tear_down() { + delete CameraHalManager::instance(); } cros::cros_camera_hal_t CROS_CAMERA_EXPORT CROS_CAMERA_HAL_INFO_SYM = { -- cgit v1.2.1