[libcamera-devel] [PATCH v3 2/3] qcam: Stop timer on timeout

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Sep 30 23:59:05 CEST 2019


Stopping the timer will reset the Timer::deadline_ field to 0 fixing
potential bugs and call QtEventDispatcher::unregisterTimer() which will
take care of the cleanup.

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
 src/qcam/qt_event_dispatcher.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qcam/qt_event_dispatcher.cpp b/src/qcam/qt_event_dispatcher.cpp
index 98d2472c37856642..43588ef081a3f633 100644
--- a/src/qcam/qt_event_dispatcher.cpp
+++ b/src/qcam/qt_event_dispatcher.cpp
@@ -131,9 +131,9 @@ void QtEventDispatcher::unregisterTimer(Timer *timer)
 void QtEventDispatcher::timerEvent(QTimerEvent *event)
 {
 	auto it = timers_.find(event->timerId());
-	timerIds_.erase(it->second);
-	killTimer(it->first);
-	timers_.erase(it);
+	Timer *timer = it->second;
+
+	timer->stop();
 }
 
 void QtEventDispatcher::processEvents()
-- 
2.23.0



More information about the libcamera-devel mailing list