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>
This commit is contained in:
committed by
Laurent Pinchart
parent
a8c9fce109
commit
459b3bc6a9
@@ -26,9 +26,10 @@ class CameraDevice;
|
||||
class CameraHalManager
|
||||
{
|
||||
public:
|
||||
CameraHalManager();
|
||||
~CameraHalManager();
|
||||
|
||||
static CameraHalManager *instance();
|
||||
|
||||
int init();
|
||||
|
||||
std::tuple<CameraDevice *, int>
|
||||
@@ -44,6 +45,8 @@ private:
|
||||
|
||||
static constexpr unsigned int firstExternalCameraId_ = 1000;
|
||||
|
||||
CameraHalManager();
|
||||
|
||||
static int32_t cameraLocation(const libcamera::Camera *cam);
|
||||
|
||||
void cameraAdded(std::shared_ptr<libcamera::Camera> cam);
|
||||
|
||||
Reference in New Issue
Block a user