From 6c4999e6a41dc11f0c3a0289c050c0d6b6174292 Mon Sep 17 00:00:00 2001
From: Jacopo Mondi <jacopo@jmondi.org>
Date: Sat, 3 Oct 2020 16:06:34 +0200
Subject: android: camera_device: Clear streams_ at stop time

When the CameraDevice is stopped, we need to clear the vector
of CameraStream instances to make sure they get deleted and all the
resources they have acquired get released.

Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/android/camera_device.cpp | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'src')

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index c6b6fe4b..0a94c1ae 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -517,6 +517,8 @@ int CameraDevice::open(const hw_module_t *hardwareModule)
 
 void CameraDevice::close()
 {
+	streams_.clear();
+
 	camera_->stop();
 	camera_->release();
 
-- 
cgit v1.2.1