From 3952d49d8db15eb0788817f97b4de9eadd036324 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 1 Jul 2019 23:27:12 +0300 Subject: test: timer: Add dynamically allocated timer test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(+) (limited to 'test/timer.cpp') diff --git a/test/timer.cpp b/test/timer.cpp index 41c132bd..addebce3 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; } -- cgit v1.2.1