[libcamera-devel] [PATCH 1/1] fix: pipeline handlers: Stop exponential explosive calls to createPipelineHandlers
Sophie Friedrich
dev at flowerpot.me
Mon Mar 6 00:06:03 CET 2023
Currently the method `createPipelineHandlers` registered itself to the
`devicesAdded` signal at the end of each call. As the Signal object
supports multiple non-unique listeners connected to it, the former
method would be called exponentially often with each new emitted event
on `devicesAdded` (i.e. with udev plugging in a new camera)
By attaching the `createPipelineHandlers` function to `devicesAdded` during
the first call to it / init of the `CameraManager::Private` this effect
is prevented.
Signed-off-by: Sophie Friedrich <dev at flowerpot.me>
---
src/libcamera/camera_manager.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index b1785f75..c1edefda 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -131,6 +131,7 @@ int CameraManager::Private::init()
return -ENODEV;
createPipelineHandlers();
+ enumerator_->devicesAdded.connect(this, &Private::createPipelineHandlers);
return 0;
}
@@ -165,8 +166,6 @@ void CameraManager::Private::createPipelineHandlers()
<< "\" matched";
}
}
-
- enumerator_->devicesAdded.connect(this, &Private::createPipelineHandlers);
}
void CameraManager::Private::cleanup()
--
2.34.1
More information about the libcamera-devel
mailing list