[libcamera-devel,v2] libcamera: pipeline: fix c++20 compile warning
diff mbox series

Message ID 20231128035231.253676-1-bbrotherton@google.com
State Accepted
Commit 61f6b372421ad96e283220c2c7beb1cb298b1eaf
Headers show
Series
  • [libcamera-devel,v2] libcamera: pipeline: fix c++20 compile warning
Related show

Commit Message

Brett Brotherton Nov. 28, 2023, 3:51 a.m. UTC
fix -Wdeprecated-this-capture error when building with c++20 by
explicity naming this in the capture

Signed-off-by: Brett Brotherton <bbrotherton@google.com>
---

updated patch to do explicit capture for C++17 and C++20 compatibility
compiled with both

 src/libcamera/pipeline_handler.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham Nov. 28, 2023, 10:30 a.m. UTC | #1
Quoting Brett Brotherton via libcamera-devel (2023-11-28 03:51:18)
> fix -Wdeprecated-this-capture error when building with c++20 by
> explicity naming this in the capture
> 
> Signed-off-by: Brett Brotherton <bbrotherton@google.com>

If this makes it through the compiler matrix then it's good with me...

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
> 
> updated patch to do explicit capture for C++17 and C++20 compatibility
> compiled with both
> 
>  src/libcamera/pipeline_handler.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> index 9c74c6cf..29e0c98a 100644
> --- a/src/libcamera/pipeline_handler.cpp
> +++ b/src/libcamera/pipeline_handler.cpp
> @@ -649,7 +649,7 @@ void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera)
>   */
>  void PipelineHandler::hotplugMediaDevice(MediaDevice *media)
>  {
> -       media->disconnected.connect(this, [=]() { mediaDeviceDisconnected(media); });
> +       media->disconnected.connect(this, [this, media] { mediaDeviceDisconnected(media); });
>  }
>  
>  /**
> -- 
> 2.43.0.rc1.413.gea7ed67945-goog
>
Laurent Pinchart Nov. 29, 2023, 1:25 a.m. UTC | #2
Hi Brett,

On Mon, Nov 27, 2023 at 08:51:18PM -0700, Brett Brotherton via libcamera-devel wrote:
> fix -Wdeprecated-this-capture error when building with c++20 by
> explicity naming this in the capture

s/fix/Fix/ and s/capture$/capture./

When sending a new version of a patch, pleasure try to go through the
review comments on the previous version.

No need to resend the patch for this, I'll update the commit message
before pushing.

> Signed-off-by: Brett Brotherton <bbrotherton@google.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> 
> updated patch to do explicit capture for C++17 and C++20 compatibility
> compiled with both
> 
>  src/libcamera/pipeline_handler.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> index 9c74c6cf..29e0c98a 100644
> --- a/src/libcamera/pipeline_handler.cpp
> +++ b/src/libcamera/pipeline_handler.cpp
> @@ -649,7 +649,7 @@ void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera)
>   */
>  void PipelineHandler::hotplugMediaDevice(MediaDevice *media)
>  {
> -	media->disconnected.connect(this, [=]() { mediaDeviceDisconnected(media); });
> +	media->disconnected.connect(this, [this, media] { mediaDeviceDisconnected(media); });
>  }
>  
>  /**

Patch
diff mbox series

diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 9c74c6cf..29e0c98a 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -649,7 +649,7 @@  void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera)
  */
 void PipelineHandler::hotplugMediaDevice(MediaDevice *media)
 {
-	media->disconnected.connect(this, [=]() { mediaDeviceDisconnected(media); });
+	media->disconnected.connect(this, [this, media] { mediaDeviceDisconnected(media); });
 }
 
 /**