diff options
author | Hirokazu Honda <hiroh@chromium.org> | 2021-05-26 17:46:28 +0900 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-05-26 23:41:43 +0300 |
commit | 459b3bc6a979a778f1689a86be3589101853977e (patch) | |
tree | 82a67fd29894b6997877935a183e206a54b52a8e /src/android/cros | |
parent | a8c9fce10952393d90fde5c954c7515f649e74eb (diff) |
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 <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/android/cros')
-rw-r--r-- | src/android/cros/camera3_hal.cpp | 3 | ||||
-rw-r--r-- | src/android/cros/meson.build | 3 |
2 files changed, 5 insertions, 1 deletions
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 <cros-camera/cros_camera_hal.h> +#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 = { diff --git a/src/android/cros/meson.build b/src/android/cros/meson.build index 4aab0f20..13ec8f0a 100644 --- a/src/android/cros/meson.build +++ b/src/android/cros/meson.build @@ -12,6 +12,7 @@ cros_hal_info = static_library('cros_hal_info', cros_hal_info_sources, dependencies : dependency('libcros_camera'), c_args : '-Wno-shadow', - include_directories : android_includes) + include_directories : [android_includes, + libcamera_includes]) libcamera_objects += cros_hal_info.extract_objects('camera3_hal.cpp') |