[libcamera-devel] [PATCH v4 1/6] libcamera: CameraManager: Drop the vector of created PipelineHandlers

Umang Jain email at uajain.com
Thu Jun 11 19:16:02 CEST 2020


This placeholder for the pipeline-handlers created by CameraManager,
was responsible to hold a reference to pipeline-handlers which were
not getting dropped anywhere in the code-path. Instead of introducing
a fix of decrementing the reference, it is decided to eliminate this
vector entirely from  the CameraManager. This is due to the fact that
the vector does not seem to have much use in CameraManager and thus
reducing futile book-keeping.

Since the vector is eliminated, there are no unchecked reference of the
pipeline-handlers. This fixes the initial issue of dangling driver directories
(for e.g. for UVC camera - in /sys/bus/usb/drivers/uvcvideo) on 'unbind' → 'bind'
operation while the CameraManager is running. The directories were still kept
around even after 'unbind' because of the pipeline-handler's unchecked reference
holding onto them.

Signed-off-by: Umang Jain <email at uajain.com>
---
 src/libcamera/camera_manager.cpp | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 576856a..b8128df 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -63,7 +63,6 @@ private:
 	bool initialized_;
 	int status_;
 
-	std::vector<std::shared_ptr<PipelineHandler>> pipes_;
 	std::unique_ptr<DeviceEnumerator> enumerator_;
 
 	IPAManager ipaManager_;
@@ -144,7 +143,6 @@ int CameraManager::Private::init()
 			LOG(Camera, Debug)
 				<< "Pipeline handler \"" << factory->name()
 				<< "\" matched";
-			pipes_.push_back(std::move(pipe));
 		}
 	}
 
@@ -162,7 +160,6 @@ void CameraManager::Private::cleanup()
 	 * they all get destroyed before the device enumerator deletes the
 	 * media devices.
 	 */
-	pipes_.clear();
 	cameras_.clear();
 
 	enumerator_.reset(nullptr);
-- 
2.26.2



More information about the libcamera-devel mailing list