[libcamera-devel] [PATCH v2] gstreamer: Fix unused variable error

Jaslo Ziska jaslo at ziska.de
Thu Nov 23 11:53:09 CET 2023


Hi Laurent,

thank you very much for taking care of this.

Laurent Pinchart <laurent.pinchart at ideasonboard.com> writes:
> From: Jaslo Ziska <jaslo at ziska.de>
>
> Commit fd84180d7a09 ("gstreamer: Implement element EOS 
> handling") has
> introduced a compilation warning with clang:
>
> ../../src/gstreamer/gstlibcamerasrc.cpp:768:23: error: unused 
> variable 'oldEvent' [-Werror,-Wunused-variable]
>                 g_autoptr(GstEvent) oldEvent = 
>                 self->pending_eos.exchange(event);
>                                     ^
>
> This seems to be a false positive, but nonetheless breaks the 
> build. Fix
> it.
>
> Fixes: fd84180d7a09 ("gstreamer: Implement element EOS 
> handling")
> Signed-off-by: Jaslo Ziska <jaslo at ziska.de>
> Signed-off-by: Laurent Pinchart 
> <laurent.pinchart at ideasonboard.com>
> ---
>  src/gstreamer/gstlibcamerasrc.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp 
> b/src/gstreamer/gstlibcamerasrc.cpp
> index 767017db63f5..a6f240f56873 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -765,8 +765,8 @@ gst_libcamera_src_send_event(GstElement 
> *element, GstEvent *event)
>
>  	switch (GST_EVENT_TYPE(event)) {
>  	case GST_EVENT_EOS: {
> -		g_autoptr(GstEvent) oldEvent = 
> self->pending_eos.exchange(event);
> -
> +		GstEvent *oldEvent = self->pending_eos.exchange(event);
> +		gst_clear_event(&oldEvent);
>  		ret = TRUE;
>  		break;
>  	}
>
> base-commit: 2fae9603e6cc483d9d0d74868721b272776513cf

The changes look good. I really don't need credit for this, its 
such a minor change and I did not contribute much.

Who would have thought that my first patch leads to such a small 
chaos ;)

Regards,

Jaslo


More information about the libcamera-devel mailing list