[libcamera-devel,1/3] libcamera: pipeline_handler: Disconnect MediaDevice::disconnected signal

Message ID 20190212223702.9582-1-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel,1/3] libcamera: pipeline_handler: Disconnect MediaDevice::disconnected signal
Related show

Commit Message

Laurent Pinchart Feb. 12, 2019, 10:37 p.m. UTC
The pipeline handler connects the disconnected signal of MediaDevice
instances registered for hotplug handling to a member slot. Disconnect
the signal when the slot is called, as the pipeline handler will be
deleted.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline_handler.cpp | 2 ++
 1 file changed, 2 insertions(+)

Comments

Niklas Söderlund Feb. 13, 2019, 10:45 a.m. UTC | #1
Hi Laurent,

Thanks for your patch.

On 2019-02-13 00:37:00 +0200, Laurent Pinchart wrote:
> The pipeline handler connects the disconnected signal of MediaDevice
> instances registered for hotplug handling to a member slot. Disconnect
> the signal when the slot is called, as the pipeline handler will be
> deleted.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/pipeline_handler.cpp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> index 4e111d6d2f55..616838fed702 100644
> --- a/src/libcamera/pipeline_handler.cpp
> +++ b/src/libcamera/pipeline_handler.cpp
> @@ -241,6 +241,8 @@ void PipelineHandler::hotplugMediaDevice(MediaDevice *media)
>   */
>  void PipelineHandler::mediaDeviceDisconnected(MediaDevice *media)
>  {
> +	media->disconnected.disconnect(this);
> +
>  	if (cameras_.empty())
>  		return;
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 4e111d6d2f55..616838fed702 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -241,6 +241,8 @@  void PipelineHandler::hotplugMediaDevice(MediaDevice *media)
  */
 void PipelineHandler::mediaDeviceDisconnected(MediaDevice *media)
 {
+	media->disconnected.disconnect(this);
+
 	if (cameras_.empty())
 		return;