summaryrefslogtreecommitdiff
path: root/src/android/camera_hal_manager.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-08-18 02:00:19 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-08-19 19:07:33 +0300
commit06166a331ceee6dfca05ee422207ebdc88138699 (patch)
tree09de8583a16194907cb9315158ada3bdece6e28b /src/android/camera_hal_manager.cpp
parent0ed40d2cd4342465cce916c3b6388d1849aef610 (diff)
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/camera_hal_manager.cpp')
-rw-r--r--src/android/camera_hal_manager.cpp9
1 files changed, 9 insertions, 0 deletions
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()
{
/*