<div dir="auto">Hi Jean-Michel,<div dir="auto">I am sending v4 with a fix.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 8 Sep, 2021, 19:42 Jean-Michel Hautbois, <<a href="mailto:jeanmichel.hautbois@ideasonboard.com">jeanmichel.hautbois@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Vedant,<br>
<br>
On 08/09/2021 15:57, Vedant Paranjape wrote:<br>
> The destructor tried to check if pipeline_ is a parent of libcameraSrc_.<br>
> This was needed to be checked as if it is, cleanup of libcameraSrc_<br>
> would be handled by pipeline itself.<br>
> <br>
> Since, the destructor can be called anytime, even when pipeline_ hasn't<br>
> been created, the use of pipeline_ to check if libcameraSrc_ has an<br>
> ancestor as pipeline_ caused a segmentation fault.<br>
> <br>
> Fixes: f58768092277 ("test: gstreamer: Fix the destructor of GstreamerTest base class")<br>
> Signed-off-by: Vedant Paranjape <<a href="mailto:vedantparanjape160201@gmail.com" target="_blank" rel="noreferrer">vedantparanjape160201@gmail.com</a>><br>
> ---<br>
>  test/gstreamer/gstreamer_test.cpp | 8 ++------<br>
>  1 file changed, 2 insertions(+), 6 deletions(-)<br>
> <br>
> diff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp<br>
> index dbdcaec0b111..e0f8de29cbd2 100644<br>
> --- a/test/gstreamer/gstreamer_test.cpp<br>
> +++ b/test/gstreamer/gstreamer_test.cpp<br>
> @@ -69,12 +69,8 @@ GstreamerTest::GstreamerTest()<br>
>  <br>
>  GstreamerTest::~GstreamerTest()<br>
>  {<br>
> -     if (libcameraSrc_ &&<br>
> -         !gst_object_has_as_ancestor(GST_OBJECT(libcameraSrc_),<br>
> -                                     GST_OBJECT(pipeline_)))<br>
> -             gst_object_unref(libcameraSrc_);<br>
> -     if (pipeline_)<br>
> -             gst_object_unref(pipeline_);<br>
> +     gst_clear_object(&pipeline_);<br>
> +     gst_clear_object(&libcameraSrc_);<br>
<br>
According to the GStreamer documentation[0], gst_clear_object is only<br>
supported since 1.16 and libcamera currently requires 1.14.<br>
<br>
You can use g_clear_object, the effect will be the same.<br>
<br>
Reviewed-by: Jean-Michel Hautbois <<a href="mailto:jeanmichel.hautbois@ideasonboard.com" target="_blank" rel="noreferrer">jeanmichel.hautbois@ideasonboard.com</a>><br>
<br>
[0]<br>
<a href="https://gstreamer.freedesktop.org/documentation/gstreamer/gstobject.html?gi-language=c#gst_clear_object" rel="noreferrer noreferrer" target="_blank">https://gstreamer.freedesktop.org/documentation/gstreamer/gstobject.html?gi-language=c#gst_clear_object</a><br>
<br>
<br>
<br>
>  <br>
>       gst_deinit();<br>
>  }<br>
> <br>
</blockquote></div>