[{"id":1419,"web_url":"https://patchwork.libcamera.org/comment/1419/","msgid":"<20190416225935.GI28515@bigcity.dyn.berto.se>","date":"2019-04-16T22:59:35","subject":"Re: [libcamera-devel] [PATCH v2 09/13] libcamera: v4l2_subdevice:\n\tClose subdevice when destroyed","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2019-04-17 01:08:35 +0300, Laurent Pinchart wrote:\n> Make sure the subdevice file descriptor isn't leaked by closing it when\n> the V4L2Subdevice instance is destroyed.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/v4l2_subdevice.h | 1 +\n>  src/libcamera/v4l2_subdevice.cpp       | 5 +++++\n>  2 files changed, 6 insertions(+)\n> \n> diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> index c71dce7d8644..e592d67dd043 100644\n> --- a/src/libcamera/include/v4l2_subdevice.h\n> +++ b/src/libcamera/include/v4l2_subdevice.h\n> @@ -35,6 +35,7 @@ public:\n>  \texplicit V4L2Subdevice(const MediaEntity *entity);\n>  \tV4L2Subdevice(const V4L2Subdevice &) = delete;\n>  \tV4L2Subdevice &operator=(const V4L2Subdevice &) = delete;\n> +\t~V4L2Subdevice();\n>  \n>  \tint open();\n>  \tbool isOpen() const;\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index e34cc1693b46..a03fadfd579e 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -112,6 +112,11 @@ V4L2Subdevice::V4L2Subdevice(const MediaEntity *entity)\n>  {\n>  }\n>  \n> +V4L2Subdevice::~V4L2Subdevice()\n> +{\n> +\tclose();\n> +}\n> +\n>  /**\n>   * \\brief Open a V4L2 subdevice\n>   *\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EA52160004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Apr 2019 00:59:36 +0200 (CEST)","by mail-lf1-x143.google.com with SMTP id o19so12971397lfl.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Apr 2019 15:59:36 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tj27sm10816332lfk.97.2019.04.16.15.59.35\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 16 Apr 2019 15:59:35 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=6RK4e4/OuPfe0i9GcEppH6904CSyWWENvSljv1avaGg=;\n\tb=lS/ean5AAL9zbjkH1nxMbQpKDi6Lmw5+9KyDCWwASxJ/FbjybKShc6QiW16i0ybEbF\n\tr8hM2CCNadLl6gkvFgy/YeadAKjAGRm77oFKOHVbRTtstWhZAuDl6cXhblZENREiqAsP\n\tYjY0twZ8kTcmX0oElSBEqegcwfSV5TWajSZ8B6HctNqnWl9yJ8YMk4EAyauV34nb+Ojh\n\tmg90QWl6uuks7mOQw6jO28SH8VzwPr/UL+Mqb48E4C/UGbf6NaS1ba/3g7PYm3OxYjpf\n\tGNOisOD+dQknzPDcBfQFEE5jHN9yOJ9zGc4J1AtuON/M+p5XxO/+MrClqncljGMyqr94\n\t7rjw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=6RK4e4/OuPfe0i9GcEppH6904CSyWWENvSljv1avaGg=;\n\tb=hNlIq5y+/sfgmQB0Vl07JEe0dP0f39ptHMBrmY338drfdXxbDMb96KUjDULkwDz775\n\tEeCnmEp6fRb67A8AVrFlnrtIfU7x5WEhyC6Gxv7wccsxvWweAcURhRGwocvrC8jBl/lz\n\tL2LtfZGa9XOu63nF/oeI2Ms03Fw7Je08+hVx8aa51zZytIneNTL5511+8u6yfqrxWrqS\n\tYTjJlzqEUaXhb6OjS0d+iorMJw4cYFGjJmk6G6xZDJRi6R6z06/06fneO4uosx6+gxf7\n\tDaP4HGW+6f4k6KQeylk0FBnaL7WltYRJ7WippVxPli55rs/j2Xb2rbDkIXVQVhVU/PLP\n\tlSwg==","X-Gm-Message-State":"APjAAAUP/e5aMD6JHr8U3xc1LgjFYEU86dikHuFbQYF1jlDYxVYWL2IR\n\ttHht4My0uzQrukB5Fhy3fDHpsw==","X-Google-Smtp-Source":"APXvYqyg4eYfDQ77/zD38O4NSO/6d2z4YN85PolBdpga/Yg3BUZtcO8rT35C8T1e/4XueF27nKBepA==","X-Received":"by 2002:a19:f801:: with SMTP id a1mr4027310lff.150.1555455576412;\n\tTue, 16 Apr 2019 15:59:36 -0700 (PDT)","Date":"Wed, 17 Apr 2019 00:59:35 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190416225935.GI28515@bigcity.dyn.berto.se>","References":"<20190416220839.1577-1-laurent.pinchart@ideasonboard.com>\n\t<20190416220839.1577-10-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190416220839.1577-10-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v2 09/13] libcamera: v4l2_subdevice:\n\tClose subdevice when destroyed","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 16 Apr 2019 22:59:37 -0000"}},{"id":1426,"web_url":"https://patchwork.libcamera.org/comment/1426/","msgid":"<20190417080313.sidkzsx7ywgpotsl@uno.localdomain>","date":"2019-04-17T08:03:13","subject":"Re: [libcamera-devel] [PATCH v2 09/13] libcamera: v4l2_subdevice:\n\tClose subdevice when destroyed","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n   I was surprised as well we didn't have this!\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nOn Wed, Apr 17, 2019 at 01:08:35AM +0300, Laurent Pinchart wrote:\n> Make sure the subdevice file descriptor isn't leaked by closing it when\n> the V4L2Subdevice instance is destroyed.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/include/v4l2_subdevice.h | 1 +\n>  src/libcamera/v4l2_subdevice.cpp       | 5 +++++\n>  2 files changed, 6 insertions(+)\n>\n> diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> index c71dce7d8644..e592d67dd043 100644\n> --- a/src/libcamera/include/v4l2_subdevice.h\n> +++ b/src/libcamera/include/v4l2_subdevice.h\n> @@ -35,6 +35,7 @@ public:\n>  \texplicit V4L2Subdevice(const MediaEntity *entity);\n>  \tV4L2Subdevice(const V4L2Subdevice &) = delete;\n>  \tV4L2Subdevice &operator=(const V4L2Subdevice &) = delete;\n> +\t~V4L2Subdevice();\n>\n>  \tint open();\n>  \tbool isOpen() const;\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index e34cc1693b46..a03fadfd579e 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -112,6 +112,11 @@ V4L2Subdevice::V4L2Subdevice(const MediaEntity *entity)\n>  {\n>  }\n>\n> +V4L2Subdevice::~V4L2Subdevice()\n> +{\n> +\tclose();\n> +}\n> +\n>  /**\n>   * \\brief Open a V4L2 subdevice\n>   *\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FD6060DB4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Apr 2019 10:02:21 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 0DB2010000C;\n\tWed, 17 Apr 2019 08:02:20 +0000 (UTC)"],"Date":"Wed, 17 Apr 2019 10:03:13 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190417080313.sidkzsx7ywgpotsl@uno.localdomain>","References":"<20190416220839.1577-1-laurent.pinchart@ideasonboard.com>\n\t<20190416220839.1577-10-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"dsf3pdffajchqil5\"","Content-Disposition":"inline","In-Reply-To":"<20190416220839.1577-10-laurent.pinchart@ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v2 09/13] libcamera: v4l2_subdevice:\n\tClose subdevice when destroyed","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 17 Apr 2019 08:02:21 -0000"}}]