From patchwork Wed Sep 8 13:43:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13769 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 C2501BDC71 for ; Wed, 8 Sep 2021 13:44:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4968B69167; Wed, 8 Sep 2021 15:44:13 +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="cNoMCwQX"; dkim-atps=neutral Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 62E1F60503 for ; Wed, 8 Sep 2021 15:44:11 +0200 (CEST) Received: by mail-pj1-x1036.google.com with SMTP id c6so1718963pjv.1 for ; Wed, 08 Sep 2021 06:44:11 -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=tEQUGxtrUNWZ8NS6La3b3j2oH5qioeLu+nKQomhr75g=; b=cNoMCwQXso8uA5bBW/XfEBQBGJZQOqx2lJZv26/atDibCdZrHtn5/qR43mWKGKyoWG 8XHpnlgL1XUB3iW17cHjzqoCrRG0eCjMtBshQXUyb7+Tnd3GwAFpptaSfJyyNE+NlPJq QbfHvoKnPj8d7XLFN9N1281vdkuVPT6Z7RVYnXH9P8Gaq1EY7l0BYSMdEcavD9JZuxxW UpsqwyRS5UplcPhVyElmo/mS30ACoVzGb2i57bJGBnWiqSak4h6RWi+rZGCq29Bq1BWv 78PcfKqB9N6opv8O90YK/rm18RzOlqhdKVhUM/jCqVym6rVH4gL/z3Q7HDcl7eBrpeaN uU6Q== 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=tEQUGxtrUNWZ8NS6La3b3j2oH5qioeLu+nKQomhr75g=; b=4LF9JsHx2LzSgk8DDOiukpLqwX4ME3q43c1ocJuOE2r51LaJAY/hqOl6InteZCvHcC L1vNIK3AevYwBS3D+hT9t716nrCXh2R3jMOBok/AQ4G6h2H6ssp/rQs6BgJXBCt/a4Dx psuu1NR2mpiB4whFuIxLhyTgUalcz7T6uufbiKcGvMCxEkT9LD9PoraUDuwDfXHjIhon D3ld1a+MU9s2kbN/ZWHRB/EJ3vhpq96HU+0aRyJe44St8p3vAbEVckBhpAlIPpEqD9RE S/la3ZHmUFJn/+ZLerjSIHJoUJaBxRADfDNYVsFePxqJWjKLIgu7kwLslcyUO/ay4eEH DubQ== X-Gm-Message-State: AOAM530LNnG9v6jc6paPWy4oelZsQwxqlrMaervEFjZz5Uqhq4p7oyQ3 LIfwUH6PZfF3NAXbrYJGoVgDxQZvEK3xS6Nq X-Google-Smtp-Source: ABdhPJyyOCemcAf1Mg5AF7O+l8HBMP+MYB43c+dUwTr++hh4udmWt9aR5gmLsl8hA9pLC4cRcTspdA== X-Received: by 2002:a17:902:784c:b0:138:f4e5:9df8 with SMTP id e12-20020a170902784c00b00138f4e59df8mr3164041pln.14.1631108649549; Wed, 08 Sep 2021 06:44:09 -0700 (PDT) Received: from localhost.localdomain ([1.186.166.2]) by smtp.googlemail.com with ESMTPSA id z6sm2394813pjn.27.2021.09.08.06.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 06:44:09 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 19:13:38 +0530 Message-Id: <20210908134338.402504-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] 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 --- 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..f1a40fcb062a 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_object_clear(pipeline_); + gst_object_clear(libcameraSrc_); gst_deinit(); }