<div dir="ltr"><div dir="ltr">Hi Kieran,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 8, 2021 at 6:36 PM Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com">kieran.bingham@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 08/09/2021 13:04, 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>
I presume the refcounting is what actually deals with the cleanup<br>
accordingly now?<br></blockquote><div><br></div><div>Right !</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Will the gst_object_unref(pipeline_); have any effect such as making<br>
libcameraSrc_ invalid? (because you said that the pipeline handler would<br></blockquote><div><br></div><div>Yes, it will unref the libcameraSrc_, and I think gst_deinit will free it. Pinging <a class="gmail_plusreply" id="plusReplyChip-0" href="mailto:nicolas@ndufresne.ca" tabindex="-1">@Nicolas Dufresne</a> for clearity.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
It looks reasonable otherwise:<br>
<br>
Reviewed-by: Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a>><br>
<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">vedantparanjape160201@gmail.com</a>><br>
> ---<br>
>  test/gstreamer/gstreamer_test.cpp | 6 ++----<br>
>  1 file changed, 2 insertions(+), 4 deletions(-)<br>
> <br>
> diff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp<br>
> index dbdcaec0b111..46fa5abaea75 100644<br>
> --- a/test/gstreamer/gstreamer_test.cpp<br>
> +++ b/test/gstreamer/gstreamer_test.cpp<br>
> @@ -69,12 +69,10 @@ 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>
> +     if (libcameraSrc_)<br>
> +             gst_object_unref(libcameraSrc_);<br>
>  <br>
>       gst_deinit();<br>
>  }<br>
> <br></blockquote><div><br></div><div>Regards,</div><div><i><b>Vedant Paranjape</b></i><br></div></div></div>