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>
This commit is contained in:
Laurent Pinchart 2019-08-18 02:00:19 +03:00
parent 0ed40d2cd4
commit 06166a331c
2 changed files with 11 additions and 0 deletions

View file

@ -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()
{
/*

View file

@ -24,6 +24,8 @@ class CameraProxy;
class CameraHalManager : public libcamera::Thread
{
public:
~CameraHalManager();
int init();
CameraProxy *open(unsigned int id, const hw_module_t *module);