From 08b2e03a8ac4758e4973d7fd549026ebeb28ff29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Sun, 30 Jun 2019 17:20:01 +0200 Subject: libcamera: timer: Stop timer when it is deleted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a timer is running while it's deleted it is still register with the event dispatcher. This causes a segmentation fault when the timer time-out and its signal is emitted. Fix this my stopping the timer when it's deleted. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/timer.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp index 1cce4508..0dcb4e76 100644 --- a/src/libcamera/timer.cpp +++ b/src/libcamera/timer.cpp @@ -43,6 +43,11 @@ Timer::Timer() { } +Timer::~Timer() +{ + stop(); +} + /** * \brief Start or restart the timer with a timeout of \a msec * \param[in] msec The timer duration in milliseconds -- cgit v1.2.1