From patchwork Wed Sep 8 13:57:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13770 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 070BABDB1D for ; Wed, 8 Sep 2021 13:57:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 90C6D6916E; Wed, 8 Sep 2021 15:57:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fTldIK+o"; dkim-atps=neutral Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E08460503 for ; Wed, 8 Sep 2021 15:57:26 +0200 (CEST) Received: by mail-pg1-x529.google.com with SMTP id q68so2683926pga.9 for ; Wed, 08 Sep 2021 06:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AIpkc8rBsWvS+SWUk+KFcID4cLtaHr2U9guZgA9iB20=; b=fTldIK+oepjz0+ch2r3D8qxs1BDv4vitbjfRdekwT1SDX+dcN3R9jeKdzbqi0i5gxe U0cAhOCwJvf8MwdJzMKaVoV28FfERiXcyYSQIRsfkS/yhQfvD+vP72BjeyfTqDeXoH1i LNdb8s9a75oAGBfs/YyWErnlSufGQnAzrwR+zmPpA93s2lOi0T89AUescE3GIXOFI5Hq 8uhlECkAiTMQyzn1BPNKGgM25Z8stsXrLftnmGU2e57bYE7mvxMpEvAeECO3R6ESB5sA K0L5edlF82RYN1sEce/IBbuokByAO0cDcuCy7jdqkVSJPcJDLzVM57jrsFaqqL7fAHMI meuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AIpkc8rBsWvS+SWUk+KFcID4cLtaHr2U9guZgA9iB20=; b=sdqLTD+Mc27+P9Whlp/8EcCk+aB4qZ4F1t80HFYJ69nTNIrcaBJevaoAse8QaIYO3D a5vOuPqeLVWjgrcNz4qfR4q2rU0UOxxQLSwAHOtsTjYAiQ58qDMJ4nxUy4kXlD5uxmA0 tk9EfvpCc/4+BO3U6Rf18HqxwX3vLPkG5jgLb6HRDjbFgcCg1T+M+IrzaMF0zQ36wJ1q 864H29XRmLeJny/d/q6bUrtbCo6bzCSL7kn9JoWGZ1XryLoBTYCIgKFPCxy8y2+KHWih eiNiOm8SjYY0CGQn9Xkwc472Ac4G/aKK59ThCsJLJk1geM5qoWh+4KWstNoUuegEtR5l jTFw== X-Gm-Message-State: AOAM530zHly5o2HGightt2/1foSEOzDfdY7d9O7VwgWeieOOkk3IWDom HIJSsaaLIDiCx6hgsAecbDJmOc9A6RE9wEhS X-Google-Smtp-Source: ABdhPJx/5eTyLm+btoIU0m2JXZC2NpaWyLQRb7D2MHEQK9pM+TS8NoS6p0RAnUtF9dmnILWPdiQfqw== X-Received: by 2002:a63:1748:: with SMTP id 8mr3759444pgx.350.1631109444668; Wed, 08 Sep 2021 06:57:24 -0700 (PDT) Received: from localhost.localdomain ([1.186.166.2]) by smtp.googlemail.com with ESMTPSA id b7sm2999399pgs.64.2021.09.08.06.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 06:57:24 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 19:27:06 +0530 Message-Id: <20210908135706.419622-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3] test: gstreamer: Fix the destructor of GstreamerTest base class X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vedant Paranjape Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The destructor tried to check if pipeline_ is a parent of libcameraSrc_. This was needed to be checked as if it is, cleanup of libcameraSrc_ would be handled by pipeline itself. Since, the destructor can be called anytime, even when pipeline_ hasn't been created, the use of pipeline_ to check if libcameraSrc_ has an ancestor as pipeline_ caused a segmentation fault. Fixes: f58768092277 ("test: gstreamer: Fix the destructor of GstreamerTest base class") Signed-off-by: Vedant Paranjape Reviewed-by: Jean-Michel Hautbois --- test/gstreamer/gstreamer_test.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp index dbdcaec0b111..e0f8de29cbd2 100644 --- a/test/gstreamer/gstreamer_test.cpp +++ b/test/gstreamer/gstreamer_test.cpp @@ -69,12 +69,8 @@ GstreamerTest::GstreamerTest() GstreamerTest::~GstreamerTest() { - if (libcameraSrc_ && - !gst_object_has_as_ancestor(GST_OBJECT(libcameraSrc_), - GST_OBJECT(pipeline_))) - gst_object_unref(libcameraSrc_); - if (pipeline_) - gst_object_unref(pipeline_); + gst_clear_object(&pipeline_); + gst_clear_object(&libcameraSrc_); gst_deinit(); }