From patchwork Wed Sep 8 12:04:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13768 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 EB61FBDB1D for ; Wed, 8 Sep 2021 12:04:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 56A8B6916E; Wed, 8 Sep 2021 14:04:41 +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="KAd1ZQNj"; dkim-atps=neutral Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D1A0360503 for ; Wed, 8 Sep 2021 14:04:39 +0200 (CEST) Received: by mail-pj1-x102f.google.com with SMTP id gp20-20020a17090adf1400b00196b761920aso1320928pjb.3 for ; Wed, 08 Sep 2021 05:04:39 -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=KBxyX/td3r8q0BFCgeoB8SJRsrxGbH4GmteP2dNg3J8=; b=KAd1ZQNjeRtyEwdORQPeomun09D9inJiC+G1OhABok6s6/CSrifEGcrxuGMOs9J8O6 fSEAACLpnAWuGy3H+Yxa7aNMxIivbdSp4N9ogzwmVDXYpcZ+jJuRpL0KrowW2avu55OJ cIEFQ2yRoY1mHWjLyRnbCWQuaODdWi0ShoZXdx202rTQwLa4pHaSk5zbYZX1xpjuepYP oy/8yqUFosvqEOvVp3Q9VA7+493QaJaS/hwjSOM65lAYUDLIPNH4fXv9zdXlAvhnKe4g oSmJX5/Q9j5Rp08ZncEjExjvMHio1oFLG7pyuXqPWwifiu1PRbh1uW6BZIGwCr/ZWmGK JZ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KBxyX/td3r8q0BFCgeoB8SJRsrxGbH4GmteP2dNg3J8=; b=mj+uAo1WkZiF1nBx7qvFqbxTYc0CHLkzHB1xS4EB683cvDqVoFi+nypO07ycCAq7G1 d1GPAf9LooxpD/3R0oNWJh636vy/IjrpUs6BVVpxTz1FCrEEbW5+JbFFNvUsbux3ysTD oc9/AjAtLaOlkHMtxwSmP0jjz0eJEzIf47iPU0zTV6RRvXEnH3VQIM72CnR0c6nEoT1e HzwApsXhPOjg908TS3mJYT5UP3ZLrRKCY7Dgc4TmrHyxucfDRWwPQZeF/SrX6XpVWIGm HgAQpMshkKXp/YnIgxyN6YDzPYxaa3lwlnVRVzGPAEklfbHPbosXSK4sT39+JdP6lYxY /UCA== X-Gm-Message-State: AOAM532LtQ4MQWlFJ40nZn7ySEj/lpU9Ym/tQcMs5MvTwHc0mOx2lO1c 6D/ay0Xvzzpmd/xVzndrpf1pONBiClX8AA== X-Google-Smtp-Source: ABdhPJyUT6thjERpJHltZGWnxAvDBy1eHSVoZE0SZB/4FWRYhli8bqOzx95d0MglSnAk8pb6xqlPLw== X-Received: by 2002:a17:902:6848:b0:13a:4ffd:202e with SMTP id f8-20020a170902684800b0013a4ffd202emr2753774pln.79.1631102677789; Wed, 08 Sep 2021 05:04:37 -0700 (PDT) Received: from localhost.localdomain ([1.186.166.2]) by smtp.googlemail.com with ESMTPSA id z33sm2651601pga.20.2021.09.08.05.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 05:04:37 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 17:34:19 +0530 Message-Id: <20210908120420.312959-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1] 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: Kieran Bingham Reviewed-by: Nicolas Dufresne --- test/gstreamer/gstreamer_test.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp index dbdcaec0b111..46fa5abaea75 100644 --- a/test/gstreamer/gstreamer_test.cpp +++ b/test/gstreamer/gstreamer_test.cpp @@ -69,12 +69,10 @@ 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_); + if (libcameraSrc_) + gst_object_unref(libcameraSrc_); gst_deinit(); }