From patchwork Mon Jul 1 20:27:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1573 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E415F6157C for ; Mon, 1 Jul 2019 22:27:34 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7B450524 for ; Mon, 1 Jul 2019 22:27:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562012854; bh=fM71fx+NHBOPQHI/uQAMpVBlx7z4A+jP1Czo2qBSoA4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qN+a3C7DJfGqfbohFl2cTgUXZfI3L+KqyIVm4quUZxtRGUZAD/fEYZNpVaMjFVSBg PJbcwf+Cg7kVpGfkxRdMSudC5BRbSeFSMsNUVhjcm211fQg4OAPKh20HIrbtwJVYKm comKXsrnz3oyqx1Smhl2l8pI5tuJJIN0NlEvWrm0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Jul 2019 23:27:12 +0300 Message-Id: <20190701202712.29332-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190630162514.20522-2-niklas.soderlund@ragnatech.se> References: <20190630162514.20522-2-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] test: timer: Add dynamically allocated timer test X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jul 2019 20:27:35 -0000 Timers should be automatically stopped and unregistered when deleted. Add a test to verify this is the case. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- test/timer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/timer.cpp b/test/timer.cpp index 41c132bd1ab2..addebce3c784 100644 --- a/test/timer.cpp +++ b/test/timer.cpp @@ -152,6 +152,17 @@ protected: return TestFail; } + /* + * Test that dynamically allocated timers are stopped when + * deleted. This will result in a crash on failure. + */ + ManagedTimer *dyntimer = new ManagedTimer(); + dyntimer->start(100); + delete dyntimer; + + timer.start(200); + dispatcher->processEvents(); + return TestPass; }