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>
This commit is contained in:
Sophie Friedrich 2023-03-06 00:06:03 +01:00 committed by Laurent Pinchart
parent cee03cd183
commit a146e05125

View file

@ -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()