From 06166a331ceee6dfca05ee422207ebdc88138699 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 18 Aug 2019 02:00:19 +0300 Subject: android: camera_hal_manager: Stop thread when destroying The CameraHalManager starts a thread that is never stopped. This leads to the thread being destroyed while running, which causes a crash. Fix this by stopping the thread and waiting for it to finish in the destructor of the CameraHalManager. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/android/camera_hal_manager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/android/camera_hal_manager.cpp') diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index 37ba0135..063080a0 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -28,6 +28,15 @@ LOG_DECLARE_CATEGORY(HAL); * their static information and to open and close camera devices. */ +CameraHalManager::~CameraHalManager() +{ + if (isRunning()) { + exit(0); + /* \todo Wait with a timeout, just in case. */ + wait(); + } +} + int CameraHalManager::init() { /* -- cgit v1.2.1