summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSophie Friedrich <dev@flowerpot.me>2023-03-06 00:06:03 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-03-06 14:35:17 +0200
commita146e05125fdac75b8ffb6a818e00a446cec65dd (patch)
treececefc870982225da2514d140203a2eac1df5cb0
parentcee03cd183126d1e0828c8ae2cc8706de2404b73 (diff)
libcamera: camera_manager: Stop exponential explosive calls to createPipelineHandlers
Currently the function `createPipelineHandlers` connects 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 function would be called exponentially often with each new emitted event on `devicesAdded` (i.e. with udev plugging in a new camera) Fix it by connecting the createPipelineHandlers() slot to `devicesAdded` signal in CameraManager::Private::init() instead. This will prevent the slot getting connected multiple times to the `devicesAdded` signal. Signed-off-by: Sophie Friedrich <dev@flowerpot.me> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/camera_manager.cpp3
1 files changed, 1 insertions, 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()