[{"id":2059,"web_url":"https://patchwork.libcamera.org/comment/2059/","msgid":"<20190630234145.GL7043@pendragon.ideasonboard.com>","date":"2019-06-30T23:41:45","subject":"Re: [libcamera-devel] [PATCH v2 1/3] libcamera: timer: Stop timer\n\twhen it is deleted","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Sun, Jun 30, 2019 at 06:25:12PM +0200, Niklas Söderlund wrote:\n> If a timer is running while it's deleted it is still register with the\n> event dispatcher. This causes a segmentation fault when the timer\n> time-out and its signal is emitted. Fix this my stopping the timer when\n> it's deleted.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nGood catch.\n\nConditioned by another patch that extends the Timer tests to catch this,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/timer.h | 1 +\n>  src/libcamera/timer.cpp   | 5 +++++\n>  2 files changed, 6 insertions(+)\n> \n> diff --git a/include/libcamera/timer.h b/include/libcamera/timer.h\n> index 97dcc01f493dc70d..f082339b1fed9de7 100644\n> --- a/include/libcamera/timer.h\n> +++ b/include/libcamera/timer.h\n> @@ -17,6 +17,7 @@ class Timer\n>  {\n>  public:\n>  \tTimer();\n> +\t~Timer();\n>  \n>  \tvoid start(unsigned int msec);\n>  \tvoid stop();\n> diff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp\n> index 1cce45085c61be2f..0dcb4e767be30b32 100644\n> --- a/src/libcamera/timer.cpp\n> +++ b/src/libcamera/timer.cpp\n> @@ -43,6 +43,11 @@ Timer::Timer()\n>  {\n>  }\n>  \n> +Timer::~Timer()\n> +{\n> +\tstop();\n> +}\n> +\n>  /**\n>   * \\brief Start or restart the timer with a timeout of \\a msec\n>   * \\param[in] msec The timer duration in milliseconds","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6422560BC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 01:42:05 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E57DE255;\n\tMon,  1 Jul 2019 01:42:04 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561938125;\n\tbh=Iwa+hTdtHNoBCPpB4Jd2+ZscoMkNZO5iRMIgOdwJEbk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oLmrhAXqAMjYekOhJROJR6aw/dQMMEouk6V3b8LsOeW1klr1dr7iqR1KmoxC3fpzY\n\t7Kzo/aFWDKGuCTYNDLCeEukZuEYiZ5QEZse/qAAN/GVInIW3Wl2NTomIYOicqgYYZo\n\tmWU6BvWKuU7cizZJmT4hPsl17tjuUCnc1V1b6CLs=","Date":"Mon, 1 Jul 2019 02:41:45 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190630234145.GL7043@pendragon.ideasonboard.com>","References":"<20190630162514.20522-1-niklas.soderlund@ragnatech.se>\n\t<20190630162514.20522-2-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190630162514.20522-2-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 1/3] libcamera: timer: Stop timer\n\twhen it is deleted","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":"Sun, 30 Jun 2019 23:42:05 -0000"}}]